Quantcast
Channel: User andrewsi - Stack Overflow
Browsing all 51 articles
Browse latest View live

Comment by andrewsi on Should I end my PHP script with exit or exit;?

Exit isn't a function. It's a language construct.

View Article



Comment by andrewsi on Should I end my PHP script with exit or exit;?

Could you explain why it's bad practice?

View Article

Comment by andrewsi on Upload CSV file into MySql

I might be missing something, but where are you setting $row?

View Article

Comment by andrewsi on mysqli_real_escape_string() expects parameter 1 to be...

You're calling mysqli_real_escape_string inside a function, and $KCC is out of scope there

View Article

Comment by andrewsi on PHP Mysql New Row Inserted into database table every...

This question is four years old. Your "answer" is little more than a cut and paste of a paragraph from GGio's answer.

View Article


Comment by andrewsi on sql query not executing on local host

Also. Does it matter that your <a> tag has no content? And that your <table> is missing the closing </tr> tags?

View Article

Comment by andrewsi on MYSQLI Statement error showing incorrect but its correct

@JohnWilliams - you're looking to see if the query is returning a literal TRUE in your first if statement; that won't happen with a SELECT statement. Instead, you should be getting a result object,...

View Article

Comment by andrewsi on PDO query inside a PHP function

With a 500 error, you should find a message inside your server error logs. That would help narrow the issue down. But I suspect what might be happening is the call to Test inside the definition of your...

View Article


Comment by andrewsi on PHP MySQL row editor showing in wrong order

You're using SELECT * in your query. If you want the fields in a specific order, have you tried SELECT rank, text, name instead?

View Article


Comment by andrewsi on Issue with Auto-Responder

Are you certain it's not being sent? If it works without URLs and fails with them, it would suggest you're running into a spam filtering issue rather than having an issue with your code.

View Article

Comment by andrewsi on Why do i get a SQL error only when page reloads?

You're closing the connection with mysqli_close($link); - it's called if the form has been submitted, but it's outside the check to see if the submit was successful. You just need to put it immediately...

View Article

Comment by andrewsi on Login Formular php/pgsql

Try echoing out the query you're running; you're confusing two kinds of string concatenation. But you shouldn't be concatenating $login directly into your query in the first place - look at using a...

View Article

Answer by andrewsi for How to set maximum life of the session to be 5 sec in PHP

Include a timestamp attribute of the $_SESSION variable. Check it periodically and expire the session according to a conditional: $_SESSION['mytimestamp'] = time();

View Article


Answer by andrewsi for Error when tried to allocate bytes

The issue is with these lines: $result = $sth->fetchAll(PDO::FETCH_ASSOC); while ($row = $result) { $data[] = $row; } You're assigning $result, and then using that value in your while loop. What is...

View Article

Answer by andrewsi for MySql Bulk(ish) Insert

When you use INSERT INTO `order_status_histories` VALUES (....) you need to pass each value that the table structure requires, in the correct order. You can omit fields from the values if they have a...

View Article


Answer by andrewsi for Adding comma between array items except for last...

Try this: $nameArray = array(); foreach (array_slice($author_array, 0, 10) as $author): $name = get_userdata($author)->display_name; $link = get_userdata($author)->user_login; $nameArray[] =...

View Article

Answer by andrewsi for updating database from session array data

foreach($_SESSION["basket_array"] as $each_item){ (mysql_query("UPDATE book SET copies=copies-1 WHERE bookid='$bookid'"); } You're not setting $bookid inside your query, so every time the query runs,...

View Article


Answer by andrewsi for Why Output of PHP script and MySQL database data are...

There's a slight flaw in your logic. The first time that your loop runs, you're updating one row - you're updating the row with position 2 to be position 3. This is fine. But the second time the loop...

View Article

Answer by andrewsi for I want to be able to insert data from forms in two tables

From the error: 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 'update (... it looks like your table is called...

View Article

Answer by andrewsi for PHP If Else shows always ELSE and prints the variable

You're using the wrong function. the_field will echo out the content of that field, without returning anything. If you want it to return a value, you need to use get_field instead. Try: $twit =...

View Article
Browsing all 51 articles
Browse latest View live




Latest Images