| | |
SQL query and HTML Tables
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: May 2008
Posts: 29
Reputation:
Solved Threads: 0
Hi,
I am a newbie to PHP and HTML and over here i am trying to display my sql results in a table format like this,
ID. Name. Contact
---------------------------------------------
----ROW1----------------------------------
----ROW2----------------------------------
any site recommendations where i can get help from? thanks alot.
I am a newbie to PHP and HTML and over here i am trying to display my sql results in a table format like this,
ID. Name. Contact
---------------------------------------------
----ROW1----------------------------------
----ROW2----------------------------------
any site recommendations where i can get help from? thanks alot.
•
•
Join Date: May 2008
Posts: 29
Reputation:
Solved Threads: 0
Ah.
thanks alot. but i have another problem again. what do they mean by,
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource ?
here is part of the code,
ORDER BY firstName ASC";
$result = mysql_query($query);
echo "<table border='1'>
<tr>
<th>ID</th>
<th>FirstName</th>
<th>LastName</th>
<th>CompanyName</th>"
while($row=mysql_fetch_row($result))
{
echo "<tr>";
echo "<td>" .$row['ID']."</td>";
echo "<td>" .$row['FirstName']."</td>";
echo "<td>" .$row['LastName']."</td>";
echo "<td>" .$row['CompanyName']."</td>";
echo "</table>";
so sorry to trouble you again. mind telling me where is my mistake?
Thanks again.
thanks alot. but i have another problem again. what do they mean by,Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource ?
here is part of the code,
ORDER BY firstName ASC";
$result = mysql_query($query);
echo "<table border='1'>
<tr>
<th>ID</th>
<th>FirstName</th>
<th>LastName</th>
<th>CompanyName</th>"
while($row=mysql_fetch_row($result))
{
echo "<tr>";
echo "<td>" .$row['ID']."</td>";
echo "<td>" .$row['FirstName']."</td>";
echo "<td>" .$row['LastName']."</td>";
echo "<td>" .$row['CompanyName']."</td>";
echo "</table>";
so sorry to trouble you again. mind telling me where is my mistake?
Thanks again.
The simplest way to solve that error is to print out the query and execute it phpmyadmin / mysql console. You will know the exact problem. You can also try
$result = mysql_query($query) or die (mysql_error()); to get the error message. Also, mysql_fetch_row should be used if you are using numeric index for your array. ie., $row[0], $row[1] and so on. If you want associated names, you should use mysql_fetch_array or mysql_fetch_assoc. Ignorance is definitely not bliss!
*PM asking for help will be ignored*
*PM asking for help will be ignored*
•
•
Join Date: May 2008
Posts: 29
Reputation:
Solved Threads: 0
•
•
•
•
The simplest way to solve that error is to print out the query and execute it phpmyadmin / mysql console. You will know the exact problem. You can also try
$result = mysql_query($query) or die (mysql_error());to get the error message. Also, mysql_fetch_row should be used if you are using numeric index for your array. ie., $row[0], $row[1] and so on. If you want associated names, you should use mysql_fetch_array or mysql_fetch_assoc.
![]() |
Similar Threads
- Dot Net programmer wanted. Work from home. (Web Development Job Offers)
- php drop down menu to search multiple sql tables (PHP)
- how to retrive data from different Ms Access tables using ASP (ASP)
- Query multiple tables with duplicate data (MySQL)
- retrieving a particular value with a sql query (PHP)
- \ Not showing? (DaniWeb Community Feedback)
- MySql multiple table query problem.... (MySQL)
Other Threads in the PHP Forum
- Previous Thread: question???
- Next Thread: Google Maps help needed.
| Thread Tools | Search this Thread |
# 5.2.10 action address apache api array auto autoincrement beginner binary broken cakephp checkbox class classes cms code cron curl database date dehasher destroy display dissertation domain dynamic echo echo$_get[x]changingitintovariable... email error errorlog fatalerror file files folder form forms function functions google href htaccess html if-else image images include insert ip javascript joomla legislation limit link load login mail masterthesis menu mlm multiple mysql mysqlquery oop open paypal pdf persist php popup problem query radio random record recursion remote script search server sessions sms sockets source space sql syntax system table tutorial update upload url validator variable video web youtube






