<?php
$connect = mysql_connect('localhost', 'root', '');
if (!$connect){
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfuly' . '<br/><br/>';
mysql_select_db("site");
$insert = "INSERT INTO site (name) VALUES ('waptrick.com');";
mysql_query("$insert");
$query = "SELECT name FROM games";
$result = mysql_query($query);
$my_rows;
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
$my_rows = $my_rows . "Site Name : {$row['name']} <br />";
}
mysql_close($connect);
echo "$my_rows;"
?>
////////////////////////////////////////////////
im having 2 problems with this code...the first is its not inserting the new row into the database
the second is "Notice: Undefined variable: my_rows in C:\wamp\www\mysql\connect.php on line 22"
i cant work out the problem for either one of these errors could someone please help me
Added after 51 minutes:
got it to insert the row im just having this problem "Notice: Undefined variable: my_rows in C:\wamp\www\mysql\connect.php on line 22" still anything ive missed ?
$connect = mysql_connect('localhost', 'root', '');
if (!$connect){
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfuly' . '<br/><br/>';
mysql_select_db("site");
$insert = "INSERT INTO site (name) VALUES ('waptrick.com');";
mysql_query("$insert");
$query = "SELECT name FROM games";
$result = mysql_query($query);
$my_rows;
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
$my_rows = $my_rows . "Site Name : {$row['name']} <br />";
}
mysql_close($connect);
echo "$my_rows;"
?>
////////////////////////////////////////////////
im having 2 problems with this code...the first is its not inserting the new row into the database
the second is "Notice: Undefined variable: my_rows in C:\wamp\www\mysql\connect.php on line 22"
i cant work out the problem for either one of these errors could someone please help me
Added after 51 minutes:
got it to insert the row im just having this problem "Notice: Undefined variable: my_rows in C:\wamp\www\mysql\connect.php on line 22" still anything ive missed ?
Comment