- Vivo X200 FE – fenséges méret
- OnePlus 15 - van plusz energia
- One mobilszolgáltatások
- Android szakmai topik
- Honor Magic6 Pro - kör közepén számok
- Xiaomi 15T Pro - a téma nincs lezárva
- Samsung Galaxy Watch8 - Classic - Ultra 2025
- Mától Huawei okosórákkal is lehet érintésmentesen fizetni
- Google Pixel topik
- Milyen okostelefont vegyek?
Új hozzászólás Aktív témák
-
Retekegér
MODERÁTOR
Hali!
Most kezdtem el hobbiból a PHP&MySQL párossal foglalkozni. Az ultraweben tesztelgetem a kódokat, most azonban elakadtam. Van egy form, ami bekéri az adatokat, amiket aztán szeretnék egy adattömben tárolni php segítségével. Íme:
<html>
<head>
<title>Alien Abduction Report</title>
</head>
<body>
<?php
$first_name = $_POST['firstname'];
$last_name = $_POST['lastname'];
$when_it_happened = $_POST['whenithappened'];
$how_long = $_POST['howlong'];
$how_many = $_POST['howmany'];
$what_they_did = $POST_['whattheydid'];
$alien_description = $_POST['aliendescription'];
$fang_spotted = $_POST['fangspotted'];
$email = $_POST['email'];
$other = $_POST['other'];
$dbc = mysqli_connect('sql4.ultraweb.hu', 'felhasználó', 'jelszó', 'adatbázis')
or die('Error connecting to MySQL server');
$query = "INSERT INTO aliens_abduction (first_name, last_name, when_it_happened,".
"how_long, how_many, alien_description, what_they_did, fang_spotted, other, email)".
"VALUES ('$first_name', '$last_name', '$when_it_happened', '$how_long', '$how_many',".
"'$alien_description', '$what_they_did', '$fang_spotted', '$other', '$email')";
$result = mysqli_query($dbc, $query)
or die('Error querying database');
mysqli_close($dbc);
echo 'Thanks for submitting the form. <br />';
echo 'You were abducted ' .$when_it_happened;
echo ' and were gone for ' .$how_long. '<br />';
echo 'Number of aliens you have seen: '.$how_many. '<br />';
echo 'The aliens did this: ' .$what_they_did. '<br />';
echo 'Description about them: ' .$alien_description. '<br />';
echo 'Was Fang there? ' .$fang_spotted. '<br />';
echo 'Other comments: '.$other. '<br />';
echo 'Your e-mail address is: ' .$email;
?>
</body>
</html>Ilyen hibaüzit kapok:
Fatal error: Call to undefined function: mysqli_connect() in /mnt/ultraweb/./../....../....../report.php on line 18
Ha átírom a mysqli-t szimpla mysql-re, akkor ez lesz az üzenet:
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /mnt/ultraweb/./../....../....../report.php on line 26
Error querying databaseTudna-e segíteni valaki, hogy megtaláljam a hibát.
Előre is köszi!
Új hozzászólás Aktív témák
- LG 48G5 - 48" OLED Tandem - 4K 144Hz & 0.1ms - MLA Plus - 2400 Nits - NVIDIA G-Sync - FreeSync
- AKCIÓ! 4TB Corsair MP600 Pro XT NVMe SSD meghajtó garanciával hibátlan működéssel
- 275 - Lenovo Legion Pro 7 (16IAX10H) - Intel Core U9 275HX, RTX 5080
- 269 - Lenovo Yoga Pro 9 (16IAH10) - Intel Core U9 285H, RTX 5060 (multitouch)
- LG 75QNED813RE / QNED / 75" - 190 cm / 4K UHD / 120Hz & 4ms / HDR Dolby Vision / HDMI 2.1
Állásajánlatok
Cég: Laptopműhely Bt.
Város: Budapest

