[Solved] selecting multiple rows mysqli

It was pretty simple, I don’t know why do I get a vote down every time I ask question. $mysqli = new mysqli(“localhost”, “root”, “”, “database”); if ($mysqli->connect_errno) { echo “Failed to connect to MySQL: (” . $mysqli->connect_errno . “) ” . $mysqli->connect_error; } $username = $_SERVER[‘REMOTE_ADDR’]; $stmt = $mysqli->prepare(“select * from `vpb_uploads` where `username` … Read more

[Solved] Can you see PHP scripts client side?

Nobody can see your code because Apache (or whatever web server you use) is instructed to EXECUTE any .php files rather than simply serve (display) them as it does by default (with .html, .css, .js, etc). I think what you may have heard of is a general security concern using PHP in general – If … Read more

[Solved] php bind_param number of variables doesn’t match number of parameters

You get the error because you bind 7 params to the query, but don’t use any of them. Instead you insert the variables directly into the query, which leads to the data being (insecurely) inserted into the database. $insert = $this->con->db->prepare(‘UPDATE users SET firstName=”‘.$updateFirstName.'”, lastName=”‘.$updateLastName.'”, username=”‘.$updateUsername.'”, email=”‘.$updateEmail.'”, profileImage=”‘.$updateProfileImage.'”, bio=”‘.$updateBio.'” WHERE userID = ‘.$userID); should be … Read more

[Solved] javascript or PHP sorting array of x,y coordinates

Use sort with a custom compare function: data.sort(function(a, b){ return a[1] – b[1]; }); Example: var data = [[4,1],[20,1],[66,1],[68,3],[70,3],[72,2],[84,1],[96,4],[102,2]]; data.sort(function(a, b){ return a[1] – b[1]; }); // data now contains: [[4,1],[20,1],[66,1],[84,1],[72,2],[102,2],[68,3],[70,3],[96,4]]; If you want to sort in descending order instead just do b[1] – a[1] instead. 5 solved javascript or PHP sorting array of x,y … Read more

[Solved] how to show only child element with php? [closed]

read interested page to string (file_get_contents, curl ) or DOMdocument / SimpleXML find interesting information in string (by RegEx or substring search) or in DOMdocument / SimpleXML (special function in DOMdocument / SimpleXML class), echo it edit: If you like jQuery you can use phpQuery edit: For bbc.com/news you can read RSS http://feeds.bbci.co.uk/news/rss.xml – it … Read more

[Solved] MySQL 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 [closed]

I assume that ‘username’ is a text/char field in your db. Try this code: mysql_query (“SELECT * FROM ” . $iAccount_table . ” WHERE username=”” . $user . “””) or die(mysql_error()); I hope you find this helpful. solved MySQL error:You have an error in your SQL syntax; check the manual that corresponds to your MySQL … Read more

[Solved] Why my if…else statement doesnt work where is my mistake and how to fix it?

Please try this code: $number = 0; $result = mysqli_query($con, $sql); if (!$result) exit(mysqli_error($con)); else $number = mysqli_num_rows($result); if ($number==0) { echo “No rented cars for this period !”; } else { while ($number){ $row = mysqli_fetch_row($result); $brand = $row[‘brand’]; $model = $row[‘model’]; $reg_num = $row[‘reg_num’]; $horse_powers = $row[‘horse_powers’]; $color = $row[‘color’]; echo $brand; $number–; … Read more

[Solved] Inserting date()->format(Y-m-d): “Call to a member function modify() on a non-object.” [closed]

You have a typo in your code. $datetime_beginning vs $datetime_bigining Try this: $datetime_beginning = new DateTime(’60 days ago’); do { $insert_days= mysql_query(“INSERT INTO $tocreate (date_full) VALUES (‘”.$datetime_beginning->format(‘Y-m-d’).”‘);”) or die(mysql_error()); $datetime_beginning->modify(‘+1 day’); }while($datetime_beginning!=$final_time); 4 solved Inserting date()->format(Y-m-d): “Call to a member function modify() on a non-object.” [closed]