DiscoTrio
Members-
Posts
78 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
DiscoTrio's Achievements
Member (2/5)
0
Reputation
-
Need help updating data in MYSQL database from PHP page
DiscoTrio replied to DiscoTrio's topic in PHP Coding Help
Here is another reason my host sucks: Warning: ini_set() has been disabled for security reasons in /www/zzl.org/r/o/b/robloxfashion/htdocs/voting.php on line 10 Warning: ini_set() has been disabled for security reasons in /www/zzl.org/r/o/b/robloxfashion/htdocs/voting.php on line 11 -
Need help updating data in MYSQL database from PHP page
DiscoTrio replied to DiscoTrio's topic in PHP Coding Help
DiscoTrio3bad For some reason the query won't go through the database... -
Need help updating data in MYSQL database from PHP page
DiscoTrio replied to DiscoTrio's topic in PHP Coding Help
yes -
Need help updating data in MYSQL database from PHP page
DiscoTrio replied to DiscoTrio's topic in PHP Coding Help
Its called the value that $rating returns, which is 1,2,3,4 I have that established and it works. And this server has SQL Buddy, I use PHPMYADMIN before... -
Need help updating data in MYSQL database from PHP page
DiscoTrio replied to DiscoTrio's topic in PHP Coding Help
Im already not liking my new hosting company, now I can't get a sing query to work, Gevans, your query makes it return "Your query did not return any results. (0.0004 seconds)" -
Need help updating data in MYSQL database from PHP page
DiscoTrio replied to DiscoTrio's topic in PHP Coding Help
Nope, thats what I just did and got that error. -
Need help updating data in MYSQL database from PHP page
DiscoTrio replied to DiscoTrio's topic in PHP Coding Help
Hmm putting the query in directly says this: The following errors were reported: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 '1 ='1' WHERE username ='DiscoTrio'' at line 1 -
Need help updating data in MYSQL database from PHP page
DiscoTrio replied to DiscoTrio's topic in PHP Coding Help
It really is called that. -
I used to be good at this but I changed servers and everything is different... Heres my code so far: <?php $rated=$_REQUEST['rated']; echo $rated; $rating=$_REQUEST['rating']; echo $rating; // Make a MySQL Connection mysql_connect("localhost", "********", "********") or die(mysql_error()); mysql_select_db("*********") or die(mysql_error()); $result = mysql_query("SELECT * FROM main WHERE username = '$rated'") or die(mysql_error()); $row = mysql_fetch_array( $result ); $votes = $db_field['$rating']; $newvotes = $votes + 1; echo $newvotes; mysql_query("UPDATE main SET $rating = '$newvotes' WHERE username = '$rated'"); ?> Whats going on here is the colomb that I want to update comes as a variable $rated (That works) and then the database selects the row to update with $username (That works) and gets the variable $newvotes by taking the original value of the data its about to update and add 1 to it (That works) Then it updates the field to $newvotes.... I don't know why the update won't go through... there are no errors....
-
Help with a log in script (Already complete and working)
DiscoTrio posted a topic in PHP Coding Help
I have a code from my friend that was written about two years back and there is one part I need help with: Somehow it remebers what page you came from and you stay on that page after you log in. I need help changing that to a certain page. Keep in mind the browser never goes to these log in scripts. This is the part of the session controll script that logs you in and somehow marks what page you came from: function startSession(){ global $database; session_start(); $this->logged_in = $this->checkLogin(); if(!$this->logged_in){ $this->username = $_SESSION['username'] = GUEST_NAME; $this->userlevel = GUEST_LEVEL; $database->addActiveGuest($_SERVER['REMOTE_ADDR'], $this->time); } else{ $database->addActiveUser($this->username, $this->time); } $database->removeInactiveUsers(); $database->removeInactiveGuests(); if(isset($_SESSION['url'])){ $this->referrer = $_SESSION['url']; }else{ $this->referrer = "/"; } $this->url = $_SESSION['url'] = $_SERVER['PHP_SELF']; } This finishes up your log in in another script: function procLogin(){ global $session, $form; /* Login attempt */ $retval = $session->login($_POST['user'], $_POST['pass'], isset($_POST['remember'])); if($retval){ header("Location: ".$session->referrer); } else{ $_SESSION['value_array'] = $_POST; $_SESSION['error_array'] = $form->getErrorArray(); header("Location: ".$session->referrer); } } In the first script I think (Not sure) these lines find out where your from and makes a value: if(isset($_SESSION['url'])){ $this->referrer = $_SESSION['url']; }else{ $this->referrer = "/"; } And this probably has somthing to do with making you go there... I am not familiar with ever using the header function... header("Location: ".$session->referrer); If I can I want to specify what page you go to after logging in... Thanx! -
Found I ddint close <script> tag...
-
So I made this code but nothing comes up... No errors, connects to database fine... <html><head></head><body> <script type="text/javascript" src="http://js.nicedit.com/nicEdit-latest.js"></script> <script type="text/javascript"> bkLib.onDomLoaded(function() { new nicEditor({buttonList : ['bold','italic','underline','left','center','right','ol','ul','fontSize','fontFamily','indent','outdent','link','unlink','striketrhough','forecolor','bgcolor','upload','xhtml']}).panelInstance('content'); }); <? include ('../variables.php'); $result = mysql_query("SELECT * FROM subjects WHERE id = '$id' LIMIT 0, 1"); while($row = mysql_fetch_array($result)){$appear = $row['appear']; $media = $row['media']; $title = $row['title']; $content = $row['content']; $text = $row['text']; $numlinks = $row['numlinks']; $link1 = $row['link1']; $link2 = $row['link2']; $link3 = $row['link3']; $link4 = $row['link4']; $link5 = $row['link5']; $link1name = $row['link1name']; $link2name = $row['link2name']; $link3name = $row['link3name']; $link4name = $row['link4name']; $link5name = $row['link5name']; echo "<form method=post action=editsub.php?fire=change>"; echo "Media type:<input type=text name='s_media' id='s_media' value='$media'><br>"; echo "Title:<input type=text name='s_title' id='s_title' value='$title'><br>"; echo "Content:<input type=text name='s_content' id='s_content' value='$content'><br>"; echo "# of links:<input type=text name='s_title' id='s_title' value='$numlinks'><br>"; echo "Link1:<input type=text name='s_link1' id='s_link1' value='$link1'> Text:<input type=text name='s_link1' id='s_link1' value='$link1'><br>"; echo "Link2:<input type=text name='s_link2' id='s_link2' value='$link2'> Text:<input type=text name='s_link2' id='s_link1' value='$link2'><br>"; echo "Link3:<input type=text name='s_link3' id='s_link3' value='$link3'> Text:<input type=text name='s_link3' id='s_link1' value='$link3'><br>"; echo "Link4:<input type=text name='s_link4' id='s_link4' value='$link4'> Text:<input type=text name='s_link4' id='s_link1' value='$link4'><br>"; echo "Link5:<input type=text name='s_link5' id='s_link5' value='$link5'> Text:<input type=text name='s_link5' id='s_link1' value='$link5'><br>"; echo "<input type=submit value=Update></form>"; } ?> </body> </html> Whats really fishy is the info shows up fine in the page source.... Have a look: <html><head></head><body> <script type="text/javascript" src="http://js.nicedit.com/nicEdit-latest.js"></script> <script type="text/javascript"> bkLib.onDomLoaded(function() { new nicEditor({buttonList : ['bold','italic','underline','left','center','right','ol','ul','fontSize','fontFamily','indent','outdent','link','unlink','striketrhough','forecolor','bgcolor','upload','xhtml']}).panelInstance('content'); }); <form method=post action=editsub.php?fire=change>Media type:<input type=text name='s_media' id='s_media' value='text'><br>Title:<input type=text name='s_title' id='s_title' value='Sample Text'><br>Content:<input type=text name='s_content' id='s_content' value='fdghdhghfghgjghjghjghjghjghjghj ghjghn ghjgfjgh'><br># of links:<input type=text name='s_title' id='s_title' value='0'><br>Link1:<input type=text name='s_link1' id='s_link1' value=''> Text:<input type=text name='s_link1' id='s_link1' value=''><br>Link2:<input type=text name='s_link2' id='s_link2' value=''> Text:<input type=text name='s_link2' id='s_link1' value=''><br>Link3:<input type=text name='s_link3' id='s_link3' value=''> Text:<input type=text name='s_link3' id='s_link1' value=''><br>Link4:<input type=text name='s_link4' id='s_link4' value=''> Text:<input type=text name='s_link4' id='s_link1' value=''><br>Link5:<input type=text name='s_link5' id='s_link5' value=''> Text:<input type=text name='s_link5' id='s_link1' value=''><br><input type=submit value=Update></form></body> </html> Any ideas on why this is happening?
-
So im making a php button to click (like an up or down arrow) to re-order a table but first I need a way to re-assign the primary key 'id' that is auto-increment. Heres a quick look at the table: idmediatitlecontenttext 1photoSample item 1http://media-cdn.tripadvisor.com/media/photo-s/00/...Lorem ipsum dolor sit amet, consectetur adipiscing... 2videoSample item 2media/himmler-poznan-large.flvIn quis nisi tellus, ut gravida elit. Sed aliquet,... So anyways see the id? Its auto increment and primary... I need a sql statement to switch the two numbers that I can run from php variables. Thank you.
-
O, I found the problem, I had to make sure it was in the address again when I clicked the button. I forgot about that Thanx guys!
-
didnt get the value in the echo, If its in the query it doesnt work, but if I just echo the variable itself it works...........