1
hrhpm
Smarty/PHP/MySQL help
  • 2006/4/6 11:29

  • hrhpm

  • Just popping in

  • Posts: 1

  • Since: 2006/4/6 1


Hi,

I'm having a problem with my smarty/php/mysql project. I can insert/update/delete from the database, but I cannot seem to view tables of the data in the database.

My viewusers.php code is as follows:


$name = $_POST["name"];
$address = $_POST["address"];


$connection = mysql_connect("localhost", "*******", "*******") or die ("Could not connect");

$db = mysql_select_db("*******", $connection);

$result = mysql_query("SELECT * FROM users") or die(mysql_error());
$number = MYSQL_NUMROWS($result);

$i = 0;
if ($number == 0) {
print "

There are no entries in the table

";
}
else {
PRINT "
";
PRINT "";
PRINT "";
PRINT "";
PRINT "";
PRINT "";
WHILE ($i < $number) {
$name = mysql_result($result,$i,"name");
$address= mysql_result($result,$i,"address");
PRINT "";
PRINT "";
PRINT "";
PRINT "";
$i++;
}
PRINT "
Name Address
$name $address
";
PRINT "
";
}

?>



Where am I going wrong?

2
zoullou
Re: Smarty/PHP/MySQL help
  • 2006/4/6 12:24

  • zoullou

  • Quite a regular

  • Posts: 250

  • Since: 2004/3/2 0


You must indicate table prefix here :
$result mysql_query("SELECT * FROM [b]xoops_[/b]users") or die(mysql_error());


Prefix is XOOPS with XOOPS 2.0.x if you haven't change it

Login

Who's Online

337 user(s) are online (189 user(s) are browsing Support Forums)


Members: 0


Guests: 337


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits