Jump to content

shiloam

Members
  • Posts

    12
  • Joined

  • Last visited

    Never

Everything posted by shiloam

  1. Dude thanks so much, it's not updating, but it's also not giving me any errors. I'm thinking it has to do with my form or something. I'll mess around with it. Also there's hope bro. I used to be atheist and doin drugs. Religion sucks, but God is real. He's straight up real dude, I dare you to try being real with Him and talking to Him. Later
  2. Yea that was part of it. For some reason I'm getting this error. Thanks for all the help man, I appreciate it. 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 '' at line 1 Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /Applications/XAMPP/xamppfiles/htdocs/1/church@arkprayer/dafiles/prayedreceive.php on line 18 <?php $id=$_POST['id']; $db="prayers"; $link = mysql_connect('localhost', 'root' , ''); if (! $link) die(mysql_error()); mysql_select_db($db , $link) or die("Select Error: ".mysql_error()); echo mysql_error(); $query = "SELECT howmanyprayed from prayerwall WHERE id = $id"; $rt=mysql_query($query); echo mysql_error(); while($nt=mysql_fetch_array($rt)){ $new_val = $row['howmanyprayed'] + 1; $update = "INSERT INTO prayerwall (howmanyprayed) VALUES ('$new_val')"; } ?> Also you didn't answer the question of why you hate everything ha.
  3. Ahh ok I'm getting it now. I needed $query = "SELECT howmanyprayed from prayerwall WHERE id = $id"; There's an auto-increment set on each prayer posted. Each prayer has an unique number value for the howmanyprayed in mysql, due to how many people press the button. So it is selecting the $id equeal to the id that they pressed.
  4. Maybe it would help if I explained a little.. There's a button on the other page that has the id of the post in it's form. It's invisible, and in the button. When they hit the "I prayed button". It sends a form to prayedreceive.php. Where it's selecting the one of the id. And then the main function is to add one to the field "howmanyprayed".. so.. [----] #4 prayed! They hit the button.. [----] #5 prayed! <?php $id=$_POST['id']; $db="prayers"; $link = mysql_connect('localhost', 'root' , ''); if (! $link) die(mysql_error()); mysql_select_db($db , $link) or die("Select Error: ".mysql_error()); echo mysql_error(); $query = "SELECT howmanyprayed from prayerwall WHERE id = $id"; //This is what I was meaning to do haha. $rt=mysql_query($query); echo mysql_error(); while($nt=mysql_fetch_array($rt)){ $new_val = $row['howmanyprayed'] + 1; $update = mysql_query( "INSERT INTO 'prayerwall' ('howmanyprayed') VALUES ('$new_val')"; } ?> Is this looking any better? I'm winging it here. Thank you I appreciate the help, also why do you hate everything?
  5. Yea I took a look at it I didn't see how bad it was. I cleaned it up a bit... If it's too far off then tell me I'll mark solved. Thank you. <?php $id=$_POST['id']; $db="prayers"; $link = mysql_connect('localhost', 'root' , ''); if (! $link) die(mysql_error()); mysql_select_db($db , $link) or die("Select Error: ".mysql_error()); echo mysql_error(); $query = "SELECT * from prayerwall BY $id"; $rt=mysql_query($query); echo mysql_error(); while($nt=mysql_fetch_array($rt)){ $new_val = $row['howmanyprayed'] + 1; "INSERT $new_val into prayerwall ( howmanyprayed) VALUES ( '$new_val')" or die("Insert Error: ".mysql_error()); mysql_close($link); } ?>
  6. Yeah I figured haha.. I'm just now picking back up php I'm no good with syntax I'm just learning.
  7. I really appreciate you guys. Could you guys help me out with a little syntax trouble. <?php $id=$_POST['id']; $db="prayers"; $link = mysql_connect('localhost', 'root' , ''); if (! $link) die(mysql_error()); mysql_select_db($db , $link) or die("Select Error: ".mysql_error()); $rt=mysql_query($query); echo mysql_error(); while($nt=mysql_fetch_array($rt)){ $result=mysql_query( $query = "SELECT howmanyprayed from prayerwall BY ". $id ."" $new_val = $row['howmanyprayed'] + 1; "INSTERT $new_val into prayerwall ( howmanyprayed) VALUES ( '$new_val')") or die("Insert Error: ".mysql_error()); mysql_close($link); ?> It's a button that's like the facebook "like" button. It's submitting a form through a button, but I'm getting this error when I submit. Parse error: syntax error, unexpected T_VARIABLE in /Applications/XAMPP/xamppfiles/htdocs/1/church@arkprayer/dafiles/prayedreceive.php on line 18 Here's the form submit button <FORM METHOD=LINK ACTION=prayedreceive.php> <INPUT TYPE=HIDDEN NAME=clickprayed value=$nt[id]> <INPUT TYPE=submit VALUE=Prayed> #$nt[id] </FORM></br></br>"; I really appreciate any help.
  8. I forgot to add this part $query="select * from prayerwall ORDER BY id DESC LIMIT 5";
  9. Thank you that's what I needed. For anyone else who needs something like this, here was my end base code. <?php $db="prayers"; $link = mysql_connect('localhost', 'root' , ''); if (! $link) die(mysql_error()); mysql_select_db($db , $link) or die("Select Error: ".mysql_error()); $query="select * from prayerwall"; $rt=mysql_query($query); echo mysql_error(); while($nt=mysql_fetch_array($rt)){ echo "$nt[name] $nt[email] $nt[prayer]<br>"; // name class and mark will be printed with one line break } ?>
  10. Ok I'm sorry guys I'm still struggling with this I don't really understand. <?PHP //do your normal mysql setup and connection calls $db="prayers"; $link = mysql_connect('localhost', 'root' , ''); if (! $link) die(mysql_error()); mysql_select_db($db , $link) or die("Select Error: ".mysql_error()); mysql_select_db($db); //get the stuff from da table $sql = "SELECT name,email,prayer FROM prayerwall BY id DESC LIMIT 10"; $dbq = mysql_query($sql); //now put it into a table. echo "<TABLE>"; while ($row = ($dbq)) { echo "<TR>"; echo "<TD>".$row[name]."</TD>"; echo "<TD>".$row[email]."</TD>"; (This is the part I don't understand) echo "<TD>".$row[prayer]."</TD>"; echo "</TR>"; } echo "</TABLE>"; ?> I want it to output where it's Name Email - Id 1 Prayer Name Email - Id 2 Prayer Name Email - Id 3 Prayer Not like Name, Name, Name Email, Email, Email Prayer, Prayer, Prayer Does that make any sense? haha.
  11. I'm ok with the 10 entries, I'm just wondering how to put them on the page. Do I need to retrieve the other fields in a seperate query? When I try to just echo '$result'; I get this error Warning: mysql_numrows() expects parameter 1 to be resource, boolean given in /Applications/XAMPP/xamppfiles/htdocs/1/retrieve.php on line 14 $result
  12. Glad to be back in the community Anyways I've got a mysql table with 4 different entries from a form. One being an id with an auto-increment. I'm wanting to arrange them into a table, descending by the id number. I'm having a hard time wrapping my mind around how to even start it and get the other 3 fields to retrieve and be in a table together. I have: $db="prayers"; $link = mysql_connect('localhost', 'root' , ''); if (! $link) die(mysql_error()); mysql_select_db($db , $link) or die("Select Error: ".mysql_error()); $query = "SELECT * FROM table prayerwall BY id DESC LIMIT 10"; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); Not sure how to retrieve the other entries and then put them into a table. A start or some help would be greatly appreciated. Thanks everyone!
×
×
  • 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.