Warning: mysql_num_rows(): ?

Gestart doorAllard9 reacties34 weergaven

10 berichten · pagina 1 van 1

Allard

Lid · Topicstarter

Berichten
970
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hallo,

Wat is er mis met dit script? Zie: http://domeinopslag.nl/

Mijn script:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<html>
<head>
    <title>SMS Berichtenbalk</title>
</head>
<body>

[COLOR= #0000BB]<?php[/COLOR]

try
[COLOR= #007700]{[/COLOR]
    [COLOR= #FF8000]// include configuration file[/COLOR]
    [URL="http://www.php.net/include"]include[/URL] [COLOR= #DD0000]includes/config.php[/COLOR][COLOR= #007700];[/COLOR]
    
    [COLOR= #FF8000]// get all messages[/COLOR]
    [COLOR= #0000BB]$result[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT message FROM "[/COLOR] [COLOR= #007700].[/COLOR] DB_PREFIX [COLOR= #007700].[/COLOR] [COLOR= #DD0000]"smsberichtenbalk ORDER BY id DESC LIMIT 5"[/COLOR][COLOR= #007700]);[/COLOR]
    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$result[/COLOR][COLOR= #007700]) >[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700])
    {[/COLOR]
        [COLOR= #FF8000]// add messages to array[/COLOR]
        [COLOR= #0000BB]$messages[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]();[/COLOR]
        [URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$row[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$result[/COLOR][COLOR= #007700]))
        {[/COLOR]
            [COLOR= #0000BB]$messages[/COLOR][COLOR= #007700][] =[/COLOR] htmlspecialchars[COLOR= #007700]([/COLOR][COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]message[/COLOR][COLOR= #007700]]);
        }[/COLOR]
        
        [COLOR= #FF8000]// output messages[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<marquee>[/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/implode"]implode[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000] || [/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$messages[/COLOR][COLOR= #007700]) .[/COLOR] [COLOR= #DD0000]</marquee>[/COLOR][COLOR= #007700];
    }
}[/COLOR]
catch[COLOR= #007700]([/COLOR]Exception [COLOR= #0000BB]$e[/COLOR][COLOR= #007700])
{[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$e[/COLOR] [COLOR= #007700]->[/COLOR] getMessage[COLOR= #007700]();
}[/COLOR]

?>

<p>
    <b>Nieuw bericht toevoegen?</b><br />
    sms WEB SD [Uw bericht] naar 3010<br />
    &euro; 0,25 p.o.b. maximaal 1 bericht(en)
</p>

</body>
</html>
0
Berichten
18.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<html>
<head>
    <title>SMS Berichtenbalk</title>
</head>
<body>

[COLOR= #0000BB]<?php[/COLOR]

try
[COLOR= #007700]{[/COLOR]
    [COLOR= #FF8000]// include configuration file[/COLOR]
    [URL="http://www.php.net/include"]include[/URL] [COLOR= #DD0000]includes/config.php[/COLOR][COLOR= #007700];[/COLOR]
    
    [COLOR= #FF8000]// get all messages[/COLOR]
    [COLOR= #0000BB]$result[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT message FROM "[/COLOR] [COLOR= #007700].[/COLOR] DB_PREFIX [COLOR= #007700].[/COLOR] [COLOR= #DD0000]"smsberichtenbalk ORDER BY id DESC LIMIT 5"[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR]
    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$result[/COLOR][COLOR= #007700]) >[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700])
    {[/COLOR]
        [COLOR= #FF8000]// add messages to array[/COLOR]
        [COLOR= #0000BB]$messages[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]();[/COLOR]
        [URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$row[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$result[/COLOR][COLOR= #007700]))
        {[/COLOR]
            [COLOR= #0000BB]$messages[/COLOR][COLOR= #007700][] =[/COLOR] htmlspecialchars[COLOR= #007700]([/COLOR][COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]message[/COLOR][COLOR= #007700]]);
        }[/COLOR]
        
        [COLOR= #FF8000]// output messages[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<marquee>[/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/implode"]implode[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000] || [/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$messages[/COLOR][COLOR= #007700]) .[/COLOR] [COLOR= #DD0000]</marquee>[/COLOR][COLOR= #007700];
    }
}[/COLOR]
catch[COLOR= #007700]([/COLOR]Exception [COLOR= #0000BB]$e[/COLOR][COLOR= #007700])
{[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$e[/COLOR] [COLOR= #007700]->[/COLOR] getMessage[COLOR= #007700]();
}[/COLOR]

?>

<p>
    <b>Nieuw bericht toevoegen?</b><br />
    sms WEB SD [Uw bericht] naar 3010<br />
    &euro; 0,25 p.o.b. maximaal 1 bericht(en)
</p>

</body>
</html>


Probeer dat eens
0
Allard

Lid · Topicstarter

Berichten
970
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Dan krijg ik:

Table domeinsave_domeinopslag.smsberichtenbalksmsberichtenbalk doesnt exist
0
Berichten
3.283
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Je hebt denk ik DB_PREFIX verkeerd gebruikt wink, tabel smsberichtenbalksmsberichtenbalk bestaat niet.
0
Allard

Lid · Topicstarter

Berichten
970
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Maar er staat bij DB_PREFIX gewoon smsberichtenbalk
0
Berichten
18.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<html>
<head>
    <title>SMS Berichtenbalk</title>
</head>
<body>

[COLOR= #0000BB]<?php[/COLOR]

try
[COLOR= #007700]{[/COLOR]
    [COLOR= #FF8000]// include configuration file[/COLOR]
    [URL="http://www.php.net/include"]include[/URL] [COLOR= #DD0000]includes/config.php[/COLOR][COLOR= #007700];[/COLOR]
    
    [COLOR= #FF8000]// get all messages[/COLOR]
    [COLOR= #0000BB]$result[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT message FROM smsberichtenbalk ORDER BY id DESC LIMIT 5"[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR]
    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$result[/COLOR][COLOR= #007700]) >[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700])
    {[/COLOR]
        [COLOR= #FF8000]// add messages to array[/COLOR]
        [COLOR= #0000BB]$messages[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]();[/COLOR]
        [URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$row[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$result[/COLOR][COLOR= #007700]))
        {[/COLOR]
            [COLOR= #0000BB]$messages[/COLOR][COLOR= #007700][] =[/COLOR] htmlspecialchars[COLOR= #007700]([/COLOR][COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]message[/COLOR][COLOR= #007700]]);
        }[/COLOR]
        
        [COLOR= #FF8000]// output messages[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<marquee>[/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/implode"]implode[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000] || [/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$messages[/COLOR][COLOR= #007700]) .[/COLOR] [COLOR= #DD0000]</marquee>[/COLOR][COLOR= #007700];
    }
}[/COLOR]
catch[COLOR= #007700]([/COLOR]Exception [COLOR= #0000BB]$e[/COLOR][COLOR= #007700])
{[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$e[/COLOR] [COLOR= #007700]->[/COLOR] getMessage[COLOR= #007700]();
}[/COLOR]

?>

<p>
    <b>Nieuw bericht toevoegen?</b><br />
    sms WEB SD [Uw bericht] naar 3010<br />
    &euro; 0,25 p.o.b. maximaal 1 bericht(en)
</p>

</body>
</html>
0
Allard

Lid · Topicstarter

Berichten
970
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ik heb het al. Maar ik moet deze stappen voldoen:

1. Voer de sql uit in uw database
2. Pas de database gegevens aan in config.php (map includes)
3. Maak op targetsms by sms-2-web door middel van de wizard een nieuwe shortcode aan
Geef als url de plaats van het script op met als laatste smshandler.php

Maar bij stap 3 zegt targetpay: Uw server antwoordt niet met 45000. Lees de documentatie of de FAQ voor meer info.

En ik heb dit script:

[COLOR= #0000BB]<?php[/COLOR]

try
[COLOR= #007700]{[/COLOR]
    [COLOR= #FF8000]// check of the script is called by TargetSMS[/COLOR]
    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/substr"]substr[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REMOTE_ADDR[/COLOR][COLOR= #007700]],[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]11[/COLOR][COLOR= #007700]) ==[/COLOR] [COLOR= #DD0000]89.184.168.[/COLOR][COLOR= #007700])
    {[/COLOR]
        [COLOR= #FF8000]// include configuration file[/COLOR]
        [URL="http://www.php.net/include"]include[/URL] [COLOR= #DD0000]includes/config.php[/COLOR][COLOR= #007700];[/COLOR]
        
        [COLOR= #FF8000]// check for request method[/COLOR]
        [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REQUEST_METHOD[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]GET[/COLOR][COLOR= #007700])
        {[/COLOR]
            [COLOR= #FF8000]// check of the get fields are not empty[/COLOR]
            [URL="http://www.php.net/if"]if[/URL][COLOR= #007700](![/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]SendTo[/COLOR][COLOR= #007700]]) && ![/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]Message[/COLOR][COLOR= #007700]]) && ![/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]ShortCode[/COLOR][COLOR= #007700]]) && ![/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]MO_MessageId[/COLOR][COLOR= #007700]]) && ![/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]operator[/COLOR][COLOR= #007700]]) && ![/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]MO_ShortKey[/COLOR][COLOR= #007700]]))
            {[/COLOR]
                [COLOR= #FF8000]// check of some fields are digits[/COLOR]
                [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/ctype_digit"]ctype_digit[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]MO_MessageId[/COLOR][COLOR= #007700]]) &&[/COLOR] [URL="http://www.php.net/ctype_digit"]ctype_digit[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]ShortCode[/COLOR][COLOR= #007700]]))
                {[/COLOR]
                    [COLOR= #FF8000]// delete the shortkey from the message[/COLOR]
                    [COLOR= #0000BB]$keywordLength[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/strlen"]strlen[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]MO_ShortKey[/COLOR][COLOR= #007700]]);[/COLOR]
                    [COLOR= #0000BB]$message[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/substr"]substr[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]Message[/COLOR][COLOR= #007700]],[/COLOR] [COLOR= #0000BB]$keywordLength[/COLOR][COLOR= #007700]);[/COLOR]
                    
                    [COLOR= #FF8000]// insert message into the database[/COLOR]
                    [COLOR= #0000BB]$result[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO "[/COLOR] [COLOR= #007700].[/COLOR] DB_PREFIX [COLOR= #007700].[/COLOR] [COLOR= #DD0000]"smsberichtenbalk (
                                                messageID, 
                                                shortCode, 
                                                shortKey, 
                                                sendTo, 
                                                operatorCode,
                                                message 
                                            ) VALUES (
                                                "[/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]MO_MessageId[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]",
                                                "[/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]ShortCode[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]",
                                                "[/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]MO_ShortKey[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]",
                                                "[/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]SendTo[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]",
                                                "[/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]operator[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]",
                                                "[/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$message[/COLOR][COLOR= #007700]) .[/COLOR] [COLOR= #DD0000]"
                                            )
                                        "[/COLOR][COLOR= #007700]);[/COLOR]
                    
                    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$result[/COLOR][COLOR= #007700])
                    {[/COLOR]
                        [COLOR= #FF8000]// everything is fine[/COLOR]
                        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]45000[/COLOR][COLOR= #007700];
                    }[/COLOR]
                    [URL="http://www.php.net/else"]else[/URL]
                    [COLOR= #007700]{[/COLOR]
                        [COLOR= #FF8000]// insert statement failed[/COLOR]
                        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]99999[/COLOR][COLOR= #007700];
                    }
                }
            }
        }
    }[/COLOR]
    [URL="http://www.php.net/else"]else[/URL]
    [COLOR= #007700]{[/COLOR]
        [COLOR= #FF8000]// access denied[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Access denied[/COLOR][COLOR= #007700];
    }
}[/COLOR]
catch[COLOR= #007700]([/COLOR]Exception [COLOR= #0000BB]$e[/COLOR][COLOR= #007700])
{[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$e[/COLOR] [COLOR= #007700]->[/COLOR] getMessage[COLOR= #007700]();
}[/COLOR]

?>
0
Berichten
18.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Wat gebeurt er als je
" . DB_PREFIX . "


uit je query haalt?
0
Allard

Lid · Topicstarter

Berichten
970
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Dan doet jij het. Thanks.
0
Berichten
13.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Komt omdat je de tabelnaam bij de PREFIX had ingevuld. PREFIX is alleen nodig als je iets voor smsberichtenbalk had staan in je database.
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren