
batwimp
Members-
Posts
319 -
Joined
-
Last visited
Everything posted by batwimp
-
filling array with both keys and values in loop
batwimp replied to stijn0713's topic in PHP Coding Help
It sounds like you want to use something like array_combine() http://us2.php.net/manual/en/function.array-combine.php -
Could you post the code that includes the containing divs a few levels up?
-
Insert key=value pair in array after given key
batwimp replied to Jessica's topic in PHP Coding Help
If you look at the last example in example #1, they seem to have inserted a value with array_splice by using an offset of zero. -
why am i seeing php when i view the source code of the page?
batwimp replied to tim@getdim's topic in PHP Coding Help
And once you do get it running, stick a semi-colon at the end of your include statement there... -
WHY INSERT fail when I put an IF inside a FOR LOOP ?
batwimp replied to vincej's topic in PHP Coding Help
According to my editing software, the for loop ends before the UPDATE is done. "Inconceivable" is a quote from the same movie xyph was (sort of) quoting. Just for fun. -
WHY INSERT fail when I put an IF inside a FOR LOOP ?
batwimp replied to vincej's topic in PHP Coding Help
Inconceivable! -
WHY INSERT fail when I put an IF inside a FOR LOOP ?
batwimp replied to vincej's topic in PHP Coding Help
Your array offset $i doesn't exist outside your for loop, so not sure what its value will be in your UPDATE statement. -
You should put your code inside code tags to make it more readable.
-
Sorry. I was actually quoting this line of code: <?php if(isset($_POST['sub_comment_reply']) && $post_count >= $max_reply_per_day && $valid = false) { I didn't realize what I had typed was a complete line of code from another part of the file. You need to change THIS line so that (I'm assuming you want): <?php if(isset($_POST['sub_comment_reply']) && $post_count >= $max_reply_per_day && $valid != false) { or it may be: <?php if(isset($_POST['sub_comment_reply']) && $post_count >= $max_reply_per_day && $valid == false) { Either way, the code you have now will set the $valid variable to false no matter what, and the IF statement will fail.
-
Doh!
-
I don't know if this will fix your problem, but you need to use the comparison operator here: $valid = false should be: $valid == false
-
Doesn't post it in the database :( (HELP PLEASE) ):
batwimp replied to buzzern96's topic in PHP Coding Help
Uhhh... I never actually posted to this thread before. I have no idea what that entry above from me is about... -
I found it. In order to pass the variable as a single argument with spaces, you need to enclose it in quotes, which means you need to quote the quotes: $arg1 = '"test 55"'; Note the double quotes are inside the single quotes.
-
You are essentially issuing this command through the command line by using exec() from PHP. This means that your arguments are separated by a space instead of a comma. So it is treating 'text' as a separate argument instead of being part of the same string. You can set up your VBS to take multiple arguments by adding them in, which should be fairly obvious: NOT TESTED Function WriteLineToFile(ntext,ntext2) Const ForReading = 1, ForWriting = 2 Dim fso, f Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.OpenTextFile("C:\inetpub\test\test.txt", ForWriting, True) f.WriteLine ntext+ntext2 Set f = fso.OpenTextFile("C:\inetpub\test\test.txt", ForReading) WriteLineToFile = f.ReadAll End Function Dim Arg, var1, var1 Set Arg = WScript.Arguments var1 = Arg(0) var2 = Arg(1) WriteLineToFile(var1, var2) But if you want to pass the entire string as a single argument with the space(s) in them, I'm not sure how to do that.
-
google tells me you're not grabbing the arguments correctly in your VBS. It should be: Function WriteLineToFile(ntext) Const ForReading = 1, ForWriting = 2 Dim fso, f Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.OpenTextFile("C:\inetpub\test\test.txt", ForWriting, True) f.WriteLine ntext Set f = fso.OpenTextFile("C:\inetpub\test\test.txt", ForReading) WriteLineToFile = f.ReadAll End Function Dim Arg, var1 Set Arg = WScript.Arguments var1 = Arg(0) WriteLineToFile(var1)
-
You aren't running that section of code from VB, but from PHP, which will not parse variables inside of single quotes (unless those single quotes are inside double quotes). Try changing them to double quotes and you will pass the value of that variable.
-
I don't know much about VBS, but for your PHP you need to lower-case your exec function and use double quotes instead: $arg1 = 'test 55'; exec("test.vbs $arg1");
-
Logic/reality check before writing query
batwimp replied to learningcurve's topic in PHP Coding Help
Do a query and post a sample output. -
Can you give more detail on how it's not working? Are you getting any errors?
-
I prefer ROT-13, but that's just me.
-
jesirose, you forgot foreach().
-
Try this: <?php include 'func.inc.php'; ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>search</title> </head> <body> <form action="" method="POST"> <p> <input type="text" name="keywords" size="17" maxlength="9" value="Enter B/L No." onfocus="if(this.value == 'Enter B/L No.'){this.value = '';}" /> <input type="submit" class="formbutton" value="Track" /> </p> </form> <?php if (isset($_POST['keywords'])) { $suffix = ""; $keywords = mysql_real_escape_string(htmlentities(trim($_POST['keywords']))); $errors = array(); if (empty($keywords)) { $errors[] = ''; } else if (strlen($keywords)<9) { $errors[] = '<br><strong>Your Bill of Lading Number must contain 9-digits.</strong>'; } else if (search_results($keywords) === false) { $errors[] = '<br><strong>Please enter a valid Bill of Lading Number.</strong>'; } if (empty($errors)) { $results = search_results($keywords); $results_num = count($results); $suffix = ($results_num !=1) ? 's' : ''; foreach($results as $result) { echo "<br><table> <thead> <tr> <th><strong>B/L No.</strong></th> <th><strong>Origin City</strong></th> <th><strong>Origin Country</strong></th> <th><strong>Destination City</strong></th> <th><strong>Destination Country</strong></th> <th><strong>Status</strong></th> <th><strong>Current Location</strong></th> </tr> </thead> <tbody> <tr> <td>{$result['Bill_No']}</td> <td>{$result['Origin_City']}</td> <td>{$result['Origin_Country']}</td> <td>{$result['Destination_City']}</td> <td>{$result['Destination_Country']}</td> <td>{$result['Status']}</td> <td>{$result['Current_Location']}</td> </tr> </tbody> </table>"; } } else { foreach($errors as $error) { echo $error, '</br>'; } } } ?> </body> </html> [/code]