-
Posts
6,906 -
Joined
-
Last visited
-
Days Won
99
Everything posted by ginerjm
-
Warning: mysqli_num_rows() expects exactly 1 parameter
ginerjm replied to dojo's topic in PHP Coding Help
Don't know why you can't - it's right up there with other info about this site. You are at the top of THIS forum and not the freaks home page? -
little help please. need to make file get uploaded by form/
ginerjm replied to lovephp's topic in PHP Coding Help
You didnt' give us an error so we don't know what's happening, but let me provide a little improvement on your code that may help you to get a better understanding of what you are doing. To process the contents of the csv file do this: while ($slice = fgetcsv($getfile, 100000000, ",")) { $col0 = $slice[0]; $col1 = $slice[1]; $col2 = $slice[2]; $col3 = $slice[3]; $col4 = $slice[4]; $col5 = $slice[5]; $col6 = $slice[6]; $col7 = $slice[7]; ... ... } A much clearer and sensible of retrieving the data read in. -
how to ensure all the input box in the form is filled
ginerjm replied to Ordinary_Shepp's topic in PHP Coding Help
You can't without using js. Or you can get the post values in your php, check them and then send the screen back with whatever they did provide and a message -
Warning: mysqli_num_rows() expects exactly 1 parameter
ginerjm replied to dojo's topic in PHP Coding Help
You get that when you don't have a query that ran. ALWAYS check the results of an operation to be sure it worked before moving on. Also as a newbie - you should read the posts at the top of the forum that say to please read them. This very problem is discussed there since everybody goes thru it once. Also I notice that your insert query is doing a second escape on your args. Not good. You already did it once, why are you doing it again? -
How to two submit button on one form with two different action
ginerjm replied to Ordinary_Shepp's topic in PHP Coding Help
Not to confuse the issue, but when a submit button is passed to the script it is not the "ID" that you look for but the "name" that you look for and in order to distinguish between multiple buttons with the same name you look for the "value". ex. <form method="POST"> <input type='submit' name='btn' value="Submit"> <input type='submit' name='btn' value="Cancel"> </form> In you php you would then do: if ( !isset($_POST['submit'])) { (handle no submit yet) } // got a click from the form $btn = $_POST['submit']; if ($btn == "Submit") { ( do the submit logic) } if ($btn == "Cancel") { (do the cancel logic) } -
little help please. need to make file get uploaded by form/
ginerjm replied to lovephp's topic in PHP Coding Help
Hard to help you with your coding when you don't show any. Read up on how it's done, write something and see what happens. Then if it doesn't work, we can help you. -
To finish your (deprecated) code: if ($title) { $row = MySQL_fetch_assoc($title); $my_title = $row['title']; } else { echo "Error running title query - message is " . MySQL_error(); exit(); } Of course you should change your db interface to mysqlI or pdo to keep up with the times.
-
:)
- 15 replies
-
Look - I debugged your problem and pointed out your failure to follow proper programming practices. At this point it's your job to solve your dilemma and Do Some Homework. (You could already be reading up on this.) Of course some other well-meaning reader here will probably capitulate and give you an answer that will allow you to continue. Oh, well......
- 15 replies
-
I've heard that before.....
- 15 replies
-
You really, really need to learn some things about data handling. Especially when you are going to put it into a query - you risk having your data corrupted, your tables deleted and worse. Take 30 mins and google something like "php input sanitizing". Yes - I could give you one simple fix right now, but you would then still be sorely lacking in the knowledge you need.
- 15 replies
-
mysqli-error should replace all that 'global' stuff you have in your die clause. As for the 'textarea' problem - since you are not scrubbing any of your input, is it possible I(probable?) that you have invalid chars in the text coming in that you need to escape? A single quote in that paragraph will break your query statement. Proper handling of your input prior to including it in a query would have protected you from this.
- 15 replies
-
Looking at this code, how did you make the determination that a "textarea" (?) was your problem? If you code returned an actual error message it would be nice if you show it to us. You could also turn on php error checking to be sure that there is no other error.
- 15 replies
-
Trying to convert set of $_post variables to date to save
ginerjm replied to learningPHP1's topic in PHP Coding Help
What the heck are those echo statements doing? I've never encountered anyone using them that way before. Please explain. Other than that you should look up the format specs on the date function since yours are definitely wrong. (You get '6969' cause you have a spec that begins with 'yy' which means the last 2 digits of the full year will come out twice.) -
Notes: 1 - you defined a public var called val1 but it is not part of your class. Correct? 2 - you defined the class and included an executable line. I do not know how that fits since it is not part of a constructor. Of course, I'm not a big OO guy. Also - you have no methods for this class. 3 - you attempt to display a property of the class that is not defined for the class. Got to be an error.
-
Can we see it where you added the error checking?
-
Turn on error checking.
-
Do you handle potential query errors by checking the results of the query before trying to use it?
-
If the page goes blank, check for php errors. Turn on error checking and see what they are.
-
Perhaps. IMHO - your code is too confusing to follow. You have JS, HTML and PHP all just running on in a single path, making it hard to understand. If you think you've got it, congratulations.
-
fputcsv() not storing comma separated string correctly?
ginerjm replied to ballhogjoni's topic in PHP Coding Help
So - where is the code that is doing this work for you? -
This seems to imply multiple dropdown boxes. Is that what you were asking about in your subject line? So - since it is to be more than one dropdown, let's start out simple. First - create the first dropdown and send it out. Then when the user clicks on a choice and submits the form, take the selected item and create the next dropdown and sent it all back to the user. Repeat for each successive dropdown that you need. PS - you can do this with ajax to make it slicker, but for now you might want to just go back and forth.
-
fputcsv() not storing comma separated string correctly?
ginerjm replied to ballhogjoni's topic in PHP Coding Help
you didn't show us the actual code. (in tags please) -
Not on the philosophy, but on the syntax. You name one function then followed by a comma and then a (correct) function call. You might want to re-think your typing there.