Wat wr0ng with thiz c0de

Started on the old forum in October 2011 · view the original in the archive · old links redirect here

4 replies · 351 views · started 15 years ago · 1 min read

3 participants
Junkle Junior · 21 posts #1

Pleaze c0derz check this c0de and c0rrect, it d0ez n0t insert data into database.

 <?php

error_reporting(1);
 
require("include/init.php");
 
include('top.php'); include('header.php'); include('navbar.php'); include('shoutbox.php'); 

$mem=mysql_real_escape_string($_POST['member']); 
$visitor=mysql_real_escape_string($_POST['visitor']); 
$fin=mysql_real_escape_string($_POST['footerin']); 
$fout=mysql_real_escape_string($_POST['footerout']); 
$css=mysql_real_escape_string($_POST['style']); 

if($_POST)
 {
$time=time(); 
$db->update_data("UPDATE b_forum SET member='$mem', visitor='$visitor', footerin='$fin', footerout='$fout', style='$css', time='$time'"); 
echo"SITE UPDATED"; }

?>
 <form name="uform" action="admin.php" method="POST">
 <table>

<div class="advert">WELCOME MESSAGE FOR VISITOR <br>
<textarea rows="5" cols="50" name="visitor" value="<?php echo $forum->visitor;?>"></textarea>
</div><br/>

<div class="advert">WELCOME MESSAGE FOR MEMBERS <br>
<textarea rows="5" cols="50" name="member" value="<?php echo $forum->member;?>"></textarea>
</div><br/>

<div class="advert">FOOTER MESSAGE FOR MEMBERS <br>
<textarea rows="5" cols="30" name="footerin" value="<?php echo $forum->footerin;?>"></textarea>
</div><br/>

<div class="advert">FOOTER MESSAGE FOR VISITOR <br>
<textarea rows="5" cols="30" name="footerin" value="<?php echo $forum->footerout;?>"></textarea>
</div><br/>

<div class="advert">SITE STYLE <br>
<textarea rows="18" cols="50" name="css" value="<?php echo $forum->style;?>"></textarea>
</div><br/>

<input type="submit" name="comment" value="comment"/>
</form><br/><br/> </table>
 </form>
something else Fellow · 2,296 posts #2

try:

"UPDATE b_forum SET member='".$mem."', visitor='".$visitor."', footerin='".$fin."', footerout='".$fout."', style='".$css."', time='".$time."'"
Junkle Junior · 21 posts #3

something else wrote: try:

"UPDATE b_forum SET member='".$mem."', visitor='".$visitor."', footerin='".$fin."', footerout='".$fout."', style='".$css."', time='".$time."'"

thanx, but ztill n0t w0rking. C0uld da pr0blems be fr0m databaze? CREATE TABLE b_forum ( id bigint(20) unsigned NOT NULL AUTO_INCREMENT, member text NOT NULL, visitor text NOT NULL, footerin text NOT NULL, footerout text NOT NULL, style text NOT NULL, time bigint(20) unsigned NOT NULL, PRIMARY KEY (id) ) ENGINE=InnoDB;

GumSlone Administrator Principal · 1,690 posts #4

you forgot "WHERE id=something" if you update something, and if you want to insert something you have to do it this way:

"INSERT INTO b_forum SET member='".$mem."', visitor='".$visitor."', footerin='".$fin."', footerout='".$fout."', style='".$css."', time='".$time."'" 

also probably the db class has a different function, instead $db->update_data( it should be $db->insert_data(

Advertise your mobile site for FREE with AdTwirl

External image (may be gone)

Junkle Junior · 21 posts #5

GumSlone wrote: you forgot "WHERE id=something" if you update something, and if you want to insert something you have to do it this way:

"INSERT INTO b_forum SET member='".$mem."', visitor='".$visitor."', footerin='".$fin."', footerout='".$fout."', style='".$css."', time='".$time."'" 

also probably the db class has a different function, instead $db->update_data( it should be $db->insert_data(

Thanx itz n0w w0rkin with inserting data. I think i have to delete the 'id' in database to be able to Update, coz i wanted to update...

Write your reply now; next you create a free account (or sign in) and it is posted right away. Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close