Jump to content

Recommended Posts

Right being new to PhP i dont know where and how to find out how to stop a script properly if i had a mysql query i want to know how to check if its done its job and if not how to display the appropriate problem message.

At the moment i want to do this for a mysql select command, a mysql update command and a mysql insert command

 

example

        if($success);
        {
           $query = "SELECT `login` FROM `accounts` WHERE login='$login' AND password='$pass'";
           $result=mysql_query($query);

if that doesnt work it echos invalid username or password

 

         $query = "UPDATE accounts SET flags = '".$flag."' WHERE login = '".$user."';";
         $result = mysql_query($query)

if that works it echos something if it doesnt work it echos something else

 

$result = mysql_query("INSERT INTO `accounts` VALUES ('', '$user', '$pass2', '', '', '0', '9', '', '', '$flag', 'enUS', '0', null);")

if that works it echos something if not something else

but if they dont do what there ment to the end maby a die involved or something?

 

Thanks

 

Blink359

Link to comment
https://forums.phpfreaks.com/topic/156793-problem-messages/
Share on other sites

Read up the function mysql_query(). You don't have to stop a script. PHP and other languages executes functions and wait for one to finish before going to the next. So if mysql_query() takes 10 mins to run, the rest of the script will have to wait 10 mins. You don't have to stop it yourself.

Link to comment
https://forums.phpfreaks.com/topic/156793-problem-messages/#findComment-825739
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.