Jump to content

TheSky

Members
  • Posts

    102
  • Joined

  • Last visited

    Never

Everything posted by TheSky

  1. how to use range in swich i want get values from $ like switch($value){case range(' 2,4 '): $value='First'; break; case range(' 5,7 '): $value='Second'; break;}
  2. hmm it deletes now automaticaly ? i think it worked
  3. delete from my_table where my_date_column > date_sub(now(), interval 30 day); :-\ it deleted all records not older then 30 days
  4. SQL query: UPDATE u_statistics replace( today, '.', '-' ) MySQL said: Documentation #1064 - 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 'replace(today, '.', '-')' at line 1 am i doing somthing wrong ?
  5. is there way to delete database rows what are like older then 30 days i have colum named today and i want like delete older then 30 days rows value is like 2011.06.12 thankyou for your time
  6. oh thanks didnt notice it ,mysql_query() is included thankyou
  7. hey i need a little help i get syntax error, unexpected T_VARIABLE in line $rowkills=$row['kills']; <? $sqltest = "SELECT * FROM data WHERE username='$name'"; $row=mysql_fetch_array($sqltest) $rowkills=$row['kills']; $rowdeaths=$row['deaths']; $nkills=$Kills-$rowkills; $ndeaths=$Deaths-$rowkills; ?>
  8. so i need to read whole book to get know how to make it ?
  9. im back agen <? include('connect.php'); $query="SELECT username FROM u_data"; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); echo "<b><center>Database Output</center></b><br><br>"; $i=0; while ($i < $num) { $first=mysql_result($result,$i,"username"); //end select user $i++; //continue $name = htmlspecialchars($first); if (empty($name)) { echo("<font color=red><b>pleas enter username!</b></font><br>"); } else { echo("<font color=green><b></b></font><br>"); //continue code } ?> i get only first user updated others are with empty value ($name)
  10. i dont have much <?php $name = htmlspecialchars($_GET['nickname']); if (empty($name)) { echo("<font color=red><b>pleas enter username!</b></font><br>"); } else { echo("<font color=green><b></b></font><br>"); // here continues ~130 rows of code what is geting data from another webpage and inserts it to database tables or updates ?>
  11. to run like mypage.php?user= (get name from database and run) and run like every 24h and like i did say i have list of usernames in database what i need run. i think it's not easy to make it
  12. Hello i have little problem i want run page with different values like mypage.php?user=username i tryed with cron job but there cant be special symbols in url and i have like list of values in database what i need run with that page is there some kind php function for that? EDIT: i want only run one page with different values
  13. UPDATE data SET value1='$value1',value2='$value2',value3='$value3',value4='$value4,value5='$value5' WHERE username='$name' thanks i found now answer for my question
  14. do i have to select database also ? i think i do and i didnt add it i did run $result = mysql_query($sql) or die(mysql_error()); and it was successful EDIT: hmm i checked i have selected in included connect file but i think i made wrong ? i want update username and add data
  15. on point i dont know how to update mysql database EDIT but is this cutoff valid?
  16. hey forum people can you help me on one problem so i have script what should update mysql table by username UPDATE data SET username='$name' WHERE value1='$value1' AND value2='$value2' AND value3='$value3' AND value4='$value4' AND value5='$value5' any ideas ?
  17. thanks for all who was helping me im realy sorry for any problems i have made //Create a query string $query = "SELECT * FROM u_data WHERE username='$username'"; //Run the query and put RESULT REFERENCE ID into variable $result = mysql_query($query) or die(mysql_error()); //Check if there are any rows in the RESULT REFERENCE ID if(mysql_num_rows($result)>0) { //User exists echo "Username already in use."; //Add proper error handling } else{ //Add data it's working now
  18. from cookie $username=$_COOKIE["username"]; username is correct becouse it adds in database (there is username value)
  19. hmm ok thanks i got my error mistake $query=("select * from u_data WHERE username='$username'"); //$res=mysql_query($query) or die(mysql_error()); if(mysql_query($query) > 0) { die("Username already in use."); } else { but now it shows only "Username already in use." hmm my brain is totaly crached :-\
  20. Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/a9953296/public_html/add_user.php on line 38 no errors, it add's data (in database user exists) so it adds new id agen but it should show error and kill the code
  21. this is mysql part of my php code <? $query=("select * from username WHERE username='$username'"); if(@mysql_query($query) > 0) { die("Username already in use."); } else { //Add data //NOW() $sql=( "INSERT INTO u_data (id,username,status) VALUES ('NULL','$username','$as')"); if (@mysql_query($sql)) { echo('<p>Your information has been Succesfuly added</p>'); } else { echo('<p>There was error adding information</p>'); } mysql_close(); } ?>
  22. if username exist continue else exist die
  23. is this part of code correct ? $query = mysql_query("select * from username WHERE username='$username'"); if(mysql_query($query) > 0) { die("Username already in use."); } else {
×
×
  • 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.