PDA

View Full Version : learning and trying...


tphotoz
08-06-2008, 12:49 AM
I've been learning a bit of PHP recently and I'm trying to create a CMS system (as the miniCMS doesn't work!)

<?php
require("includes/pixelpost.php");
?>
<?php

$short_title = (isset($_GET['short_title']));

$query = "SELECT * FROM pp_cms WHERE short_title= $short_title ";

mysql_query($query);

echo $query;

?>

Obviously I'm just starting out and just trying to show the results of the query on a page but...I think it's missing a connection to the database as I get this error

Warning: mysql_query() [function.mysql-query]: Access denied for user 'ODBC'@'localhost' (using password: NO) in .....try.php on line 30

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in .....try.php on line 30
SELECT * FROM pp_cms WHERE short_title=

searching on these forums points to the fact there is no connection. Can someone point me in the right direction? Cheers.

jaywilliams
08-06-2008, 05:12 PM
It looks like you need to connect to the database first.

I'd recommend going through some PHP/mySQL tutorials first, so you can get a feel for how they both work together.

This one is pretty good:
http://www.w3schools.com/PHP/php_mysql_intro.asp

And it has lots of code showing how to accomplish various tasks.
You can also search google for: "php mysql tutorial" which will give you many great sites.

And don't forget the wonderful PHP documentation, which normally answers ALL questions...
http://us.php.net/mysql_query