Jump to content

Search the Community

Showing results for tags 'mysql php'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (Dreamweaver, Zend, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 6 results

  1. Ok i have a code that is supposed to put the checkbox number into a data base the table is set up as playernick card1 card 2 card 3 random(to be used later so null in this application) and the date but when i fill out the form i get this error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CURRENT_DATE()')' at line 1 here is the php code from below where it connects to database $checkBox = implode(',', $_POST['whatcard']); if(isset($_POST['submit'])) { $query="INSERT INTO earlyreg VALUES (playernick,'" . $checkBox . "',.,CURRENT_DATE()')"; mysql_query($query) or die (mysql_error() ); echo "Complete"; } ?>
  2. Hello all, im new to this forum, im a noobie, just started coding about 3 weeks ago, don't be too hard on me. My question is I wan't to check for challenges a user's team posted that have not been excepted after 1 day, then auto refund the user's team back there credits, and then also delete all the challenges. So far here is my code. //Delete all matches not accepted after 1 day $arrayin = array(); $autorefund = mysql_query("SELECT * FROM `challenges` WHERE `a` = " . $team['id'] . " " . "AND `accepted` = 0 AND `completed` = 0 AND `chtype` = 1 AND (`expires` < " . ((int) time()) . ")"); if (mysql_num_rows($autorefund) > 0) { while ($autorefund = mysql_fetch_assoc($autorefund)) { $arrayin[] = $autorefund['id']; mysql_query("UPDATE `teams` SET `balance` = `balance` + " . $autorefund['credits'] . " " . "WHERE `id` IN (" . mysql_real_escape_string(implode(',', $arrayin)) . ")"); mysql_query("DELETE FROM `challenges` WHERE `a` IN " . "(" . mysql_real_escape_string(implode(',', $arrayin)) . ") " . "AND `accepted` = 0 AND `completed` = 0 AND `chtype` = 1 " . "AND (`expires` < " . ((int) time()) . ")"); } } FYI here is the code i had, it works fine, however it will only delete 1 challenge per team, not all of there challenges. $autorefund = mysql_query("SELECT * FROM `challenges` WHERE `a` = " . $team['id'] . " AND `accepted` = 0 AND `completed` = 0 AND `chtype` = 1 AND (`expires` < ".((int)time()).")"); if (mysql_num_rows($autorefund) > 0) { while ($autorefund = mysql_fetch_assoc($autorefund)) { if ($autorefund['accepted'] == 0 and $autorefund['expires'] < time()) { mysql_query("UPDATE `teams` SET `balance` = `balance` + " . $autorefund['credits'] . " WHERE `id` = " . $team['id'] . ""); mysql_query("DELETE FROM `challenges` WHERE `a` = " . $team['id'] . " AND `accepted` = 0 AND `completed` = 0 AND `chtype` = 1 AND (`expires` < ".((int)time()).")); } } } I inherited this script, its using deprecated statements, i know im not skilled to rewrite the entire site to use prepared statements.
  3. I have a table containing 6 records i want to display first four records today and today date should be saved against those 4 records.On the next day remaining two records should be displayed and first two records as well and date should be saved and flag should b incremented as well. i hope you guys are getting my point
  4. Hi, I am trying to read in the name and student number that the user entered and compare it to what is in the mysql database. My teacher suggested using found. However I am still not getting anything to echo out. Can someone lead me in the right direction? next.php <?php require 'connect.php'; //linking up to the database $link = mysqli_connect(HOST, USER, PASS, DB) or die (mysqli_connect_error()); //making a variable from the user data $name = mysqli_real_escape_string ($link, $_POST["name"]); $number = mysqli_real_escape_string ($link, $_POST["snumber"]); $course = $_POST["pcourse"]; // select all from table student which show student name and number $squery = "SELECT * FROM students"; $sresult = mysqli_query($link, $squery); while ($srow = mysqli_fetch_array($sresult)) { if ($name == $srow['uid'] && $number == $srow['student']) { if ($found) { echo "$srow[uid] $srow[student]"; } else { echo "Student does not exist"; } } } mysqli_close ($link); ?> <html> <body> <form action="index.php" method="post"> <br> <input type = "submit" value="back" name="back"> </form> </body> </html> This is my index.php that I use as my form <!DOCTYPE html> <html> <body> <h1>Course Selection</h1><br> <form action="next.php" method="post"> Name: <input type="text" name="name" placeholder="Name" required="required" maxlength="50"> <br><br> Student Number: <input type="text" name= "snumber" required="required" maxlength="9"> <br><br> <?php //form require 'connect.php'; $link = mysqli_connect(HOST, USER, PASS, DB) or die(mysqli_connect_error()); echo "Select a course: <select name = \"pcourse\">\n"; $query = "SELECT * FROM course"; $result = mysqli_query($link, $query); while ($row = mysqli_fetch_array($result)) { echo "<option> $row[code=auto:0] $row[name] $row[max]</option><br>"; } mysqli_free_result($results); mysqli_close ($link); echo " </select>\n"; ?> <br><br> <input type = "submit" value="submit" name= "submit"> </form> </body> </html>
  5. I have no code yet that why I am posting this. I need a login script something like this: if user = xxx then $db_host = "localhost";$db_user = "1234";$db_pass = "*******";$db_name = "1234";$db_table = "xxx"; else if user = yyy then $db_host = "localhost";$db_user = "1234";$db_pass = "********";$db_name = "1234";$db_table = "yyy"; else if user = zzz then $db_host = "localhost";$db_user = "1234";$db_pass = "********";$db_name = "1234";$db_table = "zzz"; else user = '' then $db_host = "localhost";$db_user = "1234";$db_pass = "********";$db_name = "1234";$db_table = "casual"; Trouble is I need to connect to the database to get the user then disconnect and reconnect to it with the correct table. Also have not attempted to write the login script for the website as I think it might be all part of the same thing.
  6. Hi.. I have a database which works fine. I ve just started using google charts to make the results look better for the U.Experience. . The example tables are very basic like: Country Visits England 4 Usa 6 Brazil 3 I get all my results form where statements so I have no tables which actually count the entries and show them in a basic table like this. My question is : Should I be using where, count() etc statements to populate the charts or should I have mini tables in my schema that present the information neatly like the above or a counter next to the id of the user/country etc e.g. so I don't need to worry about statements in the chart code.... thx for reading.
×
×
  • 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.