Posts: 45
Threads: 12
Joined: Sep 2011
Hi
I want to get the custom_id from the pages table and display it what is a good way of doing this.
Thanks
Peter
Posts: 45
Threads: 12
Joined: Sep 2011
Hi
Here is code I am using
<?php
define ('IN_COMMENTICS', '1');
require "../comments/includes/db/connect.php";
$query = mysql_query("SELECT * FROM `".$mysql_table_prefix."pages'");
if(!$con){
die('could not connect:' .mysql_error());
}
mysql_select_db("pages", $con);
$result = mysql_query("SELECT * FROM `".$mysql_table_prefix."pages'");
echo"<table border ='1'>
<tr>
<th>Custom ID</th>
</tr>";
While($row = my_sql_fetch_array($result)){
echo"<tr>";
echo"<td>". $row['custo_id]."</td>";
echo"</tr>";
}
echo"</table>";
?>
And error on page says could not connect Table a7...._comment.pages doesn't exist
Any help appreciated
Thanks
Peter
Posts: 45
Threads: 12
Joined: Sep 2011
Hi
When I am logged into my database on my server When I run
SELECT * FROM `pages` on sql query all is displayed as should be.
I just get could not connect error when i try to run it from my page .
help welcome
Thanks
Peter
Posts: 535
Threads: 31
Joined: Jul 2010
The problem with your code is that it has a ' character instead of a ` character in the query, so "SELECT * FROM `".$mysql_table_prefix."pages'"
should be
PHP Code:
<?php
"SELECT * FROM `".$mysql_table_prefix."pages`"
and $row['custo_id'] should be $row['custom_id']
Also, do you only need a custom id of a specific page, or do you need all of the custom ids?
I'm giving you three guesses...