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:

<?php

$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 "<CENTER><P>There are no entries in the table</CENTER>";
}
else {
PRINT "<CENTER>";
PRINT "<TABLE BORDER=0>";
PRINT "<tr>";
PRINT "<TD> <b> Name </b> </TD>";
PRINT "<TD> <b> Address </b> </TD>";
PRINT "</tr>";
WHILE ($i < $number) {
$name = mysql_result($result,$i,"name");
$address= mysql_result($result,$i,"address");
PRINT "<tr>";
PRINT "<TD> $name </TD>";
PRINT "<TD> $address </TD>";
PRINT "</tr>";
$i++;
}
PRINT "</TABLE>";
PRINT "</CENTER>";
}

?>



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

56 user(s) are online (34 user(s) are browsing Support Forums)


Members: 0


Guests: 56


more...

Donat-O-Meter

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

Latest GitHub Commits