|
Posted by plemon on 11/26/06 17:00
no no its there its just not important and not connected to the issue
thats why i left it out less code you need to rummage through if that
wasnt working i would get could not connect to database error but here
it is anyway:
<?php // Update_site.php
// This script edits a blog entry using an UPDATE query.
// Address error handing.
ini_set ('display_errors', 1);
error_reporting (E_ALL & ~E_NOTICE);
// Connect and select.
if ($dbc = @mysql_connect ('localhost', 'user', 'pass')) {
if (!@mysql_select_db ('kirewire_tpp')) {
die ('<p>Could select the database because: <b>' . mysql_error() .
'</b></p>');
}
} else {
die ('<p>Could not connect to MySQL because: <b>' . mysql_error() .
'</b></p>');
}
Andrew DeFaria wrote:
> so many sites so little time wrote:
> > alright so i deleted the part about you must have made a mistake in
> > using this page
> > and added
> > if (!$r) {
> > // There was an error
> > // for simplicity sake, I'll just print it and exit
> > exit('Error in query (' . $query . '): ' . mysql_error());
> > }
> > and as you can see at kirewire.com/pp2/update_site.php
> > all it says now is you must have made a mistake in your query
> >
> > agian the queries are:
> >
> > <snip>
> > // Define the query.
> > $query = "UPDATE home SET header='{$_POST['header']}',
> > body='{$_POST['body']}' WHERE home_id={$_POST['id']}";
> > $r = mysql_query ($query); // Execute the query.
> > </snip>
> > and
> > <snip>
> > // Define the query.
> > $query = "SELECT * FROM home WHERE home_id={$_GET['id']}";
> > if ($r = mysql_query ($query)) { // Run the query.
> >
> > $row = mysql_fetch_array ($r); // Retrieve the information.
> > </snip>
> > Erwin Moller wrote:
> >
> Forgive me but I didn't see in your original code where you connected to
> the database at all.
>
> You might try running mysql from the command line and copy and pasting
> that exact query in. Then play with it until your figure out what's
> wrong with the query...
>
> --
>
> Andrew DeFaria <http://defaria.com>
> Ever stop to think, and forget to start again?
>
> --------------080309080406020402070802
> Content-Type: text/html; charset=ISO-8859-1
> X-Google-AttachSize: 1695
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> <html>
> <head>
> <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
> <title></title>
> </head>
> <body bgcolor="#ffffff" text="#000000">
> so many sites so little time wrote:
> <blockquote
> cite="mid1164498386.771276.175300@j72g2000cwa.googlegroups.com"
> type="cite">
> <pre wrap="">alright so i deleted the part about you must have made a mistake in
> using this page
> and added
> if (!$r) {
> // There was an error
> // for simplicity sake, I'll just print it and exit
> exit('Error in query (' . $query . '): ' . mysql_error());
> }
> and as you can see at kirewire.com/pp2/update_site.php
> all it says now is you must have made a mistake in your query
>
> agian the queries are:
>
> <snip>
> // Define the query.
> $query = "UPDATE home SET header='{$_POST['header']}',
> body='{$_POST['body']}' WHERE home_id={$_POST['id']}";
> $r = mysql_query ($query); // Execute the query.
> </snip>
> and
> <snip>
> // Define the query.
> $query = "SELECT * FROM home WHERE home_id={$_GET['id']}";
> if ($r = mysql_query ($query)) { // Run the query.
>
> $row = mysql_fetch_array ($r); // Retrieve the information.
> </snip>
> Erwin Moller wrote:
> </pre>
> </blockquote>
> Forgive me but I didn't see in your original code where you connected
> to the database at all.<br>
> <br>
> You might try running mysql from the command line and copy and pasting
> that exact query in. Then play with it until your figure out what's
> wrong with the query...<br>
> <pre>-- </pre>
> <a href="http://defaria.com">Andrew DeFaria</a><br>
> <small><font color="#999999">Ever stop to think, and forget to start
> again?</font></small>
> </body>
> </html>
>
> --------------080309080406020402070802--
Navigation:
[Reply to this message]
|