Results 1 to 6 of 6

Thread: php / mysql error Again

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2002
    Location
    Newcastle
    Posts
    260

    Resolved php / mysql error Again

    Ok this time the code below should query the db and flag if there are 2 records already in the db matching the time and date, yet it doesnt - however as before with my other problems it works fine on my test server so any clues any one

    PHP Code:
    $alarm_check "SELECT atime, datetoplay FROM maintable WHERE atime = '" $_POST['alarmtime'] . "' And datetoplay = '" $_POST['datebox'] . "'"// check if username exists in database.

            
    if (!($alarm_check)) print mysql_error();
            
    $result1 mysql_query($alarm_check);
            
    $num_row mysql_num_rows($result1);
        
            if (
    $num_row == 2)
                
            {
                die(
    '<p align="center"><strong><font face="Century Gothic">Im sorry but this time slot is full.</font></strong></p><p align="center"><font face="Century Gothic"><a href="newentry.php">Please go back and pick another time</a></font></p><p align="center"><a href="index.html"><img src="images/smallhouse.gif" alt="Home" width="53" height="67" border="0"></a></p>');
                
    //die ($num_row);
            

    many thanks chrisio
    Last edited by Chrisio; Dec 5th, 2004 at 12:52 PM. Reason: resolved

  2. #2
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: php / mysql error Again

    So what error are you getting?
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2002
    Location
    Newcastle
    Posts
    260

    Re: php / mysql error Again

    Thats just it im not getting any it just posts it to the db and shows the page as though there were less than 2 entrys

  4. #4
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: php / mysql error Again

    Your server configurations may be different. I suspect that an error is occuring in your query. It would help to chekc the query result rather than the query text after you have called mysql_query(). Change your code to this to see if you get an error dispalyed.
    PHP Code:
    error_reporting(E_ALL);

    $alarm_check "SELECT atime, datetoplay FROM maintable WHERE atime = '" $_POST['alarmtime'] . "' And datetoplay = '" $_POST['datebox'] . "'"// check if username exists in database.

            
    if (! ($result1 mysql_query($alarm_check))) {
        die(
    mysql_error());
    }

    $num_row mysql_num_rows($result1);
        
    if (
    $num_row == 2) {
                die(
    '<p align="center">
    <strong><font face="Century Gothic">Im sorry but this time slot is full.</font></strong>
    </p><p align="center"><font face="Century Gothic"><a href="newentry.php">Please go back and pick another time</a></font></p>
    <p align="center"><a href="index.html"><img src="images/smallhouse.gif" alt="Home" width="53" height="67" border="0"></a>
    </p>'
    );


    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2002
    Location
    Newcastle
    Posts
    260

    Re: php / mysql error Again

    thanks very much all it required was some one with a bit off knowledge and I found it in a missspelled variable

    it was relating to the sql query

    thanks again
    chrisio

  6. #6
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: php / mysql error Again

    Its always a good idea to set error reporting to E_ALL while developing. The display of notices when you misspell variables is a god send and without it you can get some very strange and confusing errors.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width