Can anybody give me a basic full php-mysql insert into block of code for mysqli() and mysql_connect(). Many thanks
+1
A:
Have a look at:
The mysqli
version function usually have an i
suffixed after mysql
keyword. More on mysqli functions.
Sarfraz
2010-09-14 13:21:11
+3
A:
The PHP manual has excellent example blocks for almost every command.
mySQL:
mysql_query
mySQLi:
mysqli_connect
Pekka
2010-09-14 13:21:23
+1
A:
For connecting and selecting a database (selecting is optional):
$con = mysql_connect($username, $password);
$db = mysql_select_db($dbname);
Querying:
$result = mysql_query("SELECT id,name FROM table");
if(!$result) {
echo mysql_error();
}
while($row = mysql_fetch_assoc($result)) {
echo "Row data: " . $row['id'] . " - " . $row['name'];
}
halfdan
2010-09-14 13:23:44