-
Posts
6,906 -
Joined
-
Last visited
-
Days Won
99
Everything posted by ginerjm
-
Parms (parameters or arguments) go inside a function call's parentheses. And all arguments are separated by commas.
-
I'd guess that it is an include (or require) trying to bring in a module repeatedly. Perhaps this is something that changed in a newer version and is now showing as an error whereas it didn't before. Probably have to change all the includes/requires to the "_once" form.
-
ok - so add "$link" as the only parm to mysqli_error() and as the first parm to the mysqli_query call.
-
I included a reference to $votes in the query by mistake. It should be "Votes = Votes + 1" still. (is 'votes' really capped in the table?)
-
So many little things..... 1 - in your connect you had a semi in the middle. 2 - in your connect you are including the dbname, so you don't need to do a select db 3 - your check if 'song' was set had a semi in the middle again. 4 - the code incrementing votes is flawed; you haven't looked up the current value so why add now? 5 - you connected with mysqli but you escaped with MySQL corrected code (hopefully) session_start(); error_reporting(E_ALL | E_STRICT | E_NOTICE); ini_set('display_errors', '1'); .. .. .. $host="localhost"; $user="*****"; $pwd="******"; $dbname="jingleko_reloader"; $link = mysqli_connect($host,$user,$pwd,$dbname) or die(mysqli_error()); $song = mysqli_real_escape_string($link,$_GET['Song']); $songSafeHtml = htmlspecialchars($_GET['Song']); if (mysqli_query("UPDATE voting SET Votes= $Votes WHERE Song = '$song'")) echo "You voted for $songSafeHtml"; else die(mysqli_error()); Please try this verbatim.
-
turn on php error checking as well. error_reporting(E_ALL | E_STRICT | E_NOTICE); ini_set('display_errors', '1'); Place these right after you session_start line or at the beginning of all of your php code
-
Besides the previous post, you might make your code easier to read and your (coding) life easier in general if you do this: <div class = 'header'> <?php if (isset($_SESSION['popo']) && $_SESSION['popo'] == "POPO") { echo "<h2><br> POPO IS GREAT </br></h2>"; } else { echo "<h2><br> POPO IS LATE </br></h2>"; } ?> </div> If you simply must intermingle your html and your php, avoiding the on/off on/off on/off method of doing it is easier in general.
-
Need help with Processing Page of PHP program
ginerjm replied to jameshay's topic in PHP Coding Help
You have 3 vars defined that don't connect to anything $ISBN10 $ISBN_Arr $ISBNARR Perhaps that is your problem, or at least the beginning. If you turned on php error checking/display you would probably see some error messages that would help you clean up your code. error_reporting(E_ALL | E_STRICT | E_NOTICE); ini_set('display_errors', '1'); Put this at the top of your script. Be sure to turn off display_errors once you put this into production.- 2 replies
-
- php
- validation
-
(and 2 more)
Tagged with:
-
Double quotes, not single quotes.
- 10 replies
-
- mobile device identification
- header
-
(and 1 more)
Tagged with:
-
Why do you re-create the array every time you begin???
-
If you haven't found the sql error yet, may I suggest that you probably can not use DESC when doing ORDER BY RAND(). Logically, how can you have a random sequence, but then say you want it in a specific order?
-
really? If you need to be taught how to use google to find things, then your php learning curve is going to be a very, very long one. I suggest you give it a try again. Type in "php check for alphabetic".
-
Have you tried to google this problem? Very first response to a simple search returned the exact php function you need.
-
If you look at the manual under $_FILES there is a user-added note concerning exactly this issue. Apparently you haven't provided a file to be uploaded, so the FILEs array isn't created.
-
What is wrong with your NEW code? You didn't tell us. If there is a line number in the message, please indicate that in your next code posting.
-
1 - read the rules and post using the proper tags. 2 - how about giving us a couple of your error messages? 3 - php statements must end with a semi 4 - separate your html code from your php code and you won't leave php mode on while you are typing html and vice versa. Coders who mingle html/js/php in their scripts are just asking for pain and confusion.
-
Can you post all that code so we can see it too?
-
Numeric fields usually don't need quotes on the values. That may cause the query to not be running. Try this syntax: $q = "update........ where......."; echo "Query is <br>$q"; $qresults = MySQL_query($q); if (!$qresults) { echo "Error in query - msg is<br>" . MySQL_error(); exit(); } By assigning the query result to a variable you can check the success/failure of the query. By assigning the query statement to a variable you can positively be sure that you are echoing the exact query statement.
-
Deprecated! Deprecated! Deprecated! (A guru should know the difference between deprecation and depreciation. )
-
You might also use mysqlI_* functions since you opened up your connection that way.
-
You do a little research on how to write sql statements. Looking for the largest value will involve using the sql 'max' function - try looking that up and then you can write your own code.
-
What do you mean you have been able to do this with sessions? And why "of course only the administrator" in the following? You already said only the admin will be able to even do this. And how "permanent" do you want this selection to be? Permanent as in always? Permanent for the current session? Permanent for the current user? Very confusing statements overall.
-
I'm guessing that connect-db.php failed you. The var $db is not a pdo object yet. Do you handle errors in that connect-db module?
-
1 - I wonder why you suppress the outcome of your ini-set statements? What are you hiding from yourself / the user? If anything, during development you WANT to see if there is an unexpected outcome, no? 2 - this line: ini_set('upload_max_filesize', '1024000000000M'); is asking for an inordinately HUGE filesize. The M indicates megabytes already, so why so many zeros? Don't you just want ini_set('upload_max_filesize', '20M'); I wonder if #1 is preventing you from seeing an error message caused by #2?
-
Add an echo statement to ensure that the code you think is working truly is.