
phpsane
Members-
Content Count
320 -
Joined
-
Last visited
Community Reputation
0 NeutralAbout phpsane
-
Rank
Advanced Member
Profile Information
-
Gender
Not Telling
Recent Profile Visitors
1,176 profile views
-
I did not find these shortcuts I mention in the FM. Did you ?
-
Oh! But I wrote the mysqli_prepare in the 2nd line. You saying that is incorrect as mysqli_prepare should be in the 1st line with the $query ? If so, then how come you aswell as others here and in other forums like the Devshed forum never brought this to my attention ever before ? Because what you see here is how I have been doing prepared statements in all my threads and posts on many forums including this one and DevShed for over a yr now and no-one said (not even Requinix and Barand who been helping me out here and Devshed like you) what you are saying now to bring this issue to my att
-
Long Version Associative Array: /* associative array */ $row = mysqli_fetch_array($result, MYSQLI_ASSOC); echo $row["name"]." ".$row["author_name"]." ".$row['price']; Short Version Associative Array: ($row = mysqli_fetch_assoc($result)) As in: while ($row = mysqli_fetch_assoc($result)) { echo $row["name"]." ".$row["class"]." ".$row['roll_no']."<br />"; Q1. Correct ? Q2. Long Version Numeric Array: /* numeric array */ $row = mysqli_fetch_array($result, MYSQLI_NUM); echo $row[0]." ".$row[1]." ".$row[2];
-
Teach Me To Convert OOP Pagination To Procedural
phpsane replied to phpsane's topic in PHP Coding Help
I think this line found in the tutorial is an error: $total_pages = $conn->query('SELECT * FROM browsing_histories')->num_rows; It should not have been $total_pages but $total_records. Correct ? Tutorial here: https://codeshack.io/how-to-create-pagination-php-mysql/ -
Teach Me To Convert OOP Pagination To Procedural
phpsane replied to phpsane's topic in PHP Coding Help
If you look closely then you will see I originally did what you suggested. However, saying all this, I am stuck on this line and so care to help me convert that ? $total_pages = $conn->query('SELECT * FROM browsing_histories')->num_rows; //I NEED HELP TO SUBSTITUTE THIS TO PROCEDURAL STYLE -
Teach Me To Convert OOP Pagination To Procedural
phpsane replied to phpsane's topic in PHP Coding Help
I commented-out their lines and added mine beneath their lines that I substituted. -
Folks, Look what I found here: https://codeshack.io/how-to-create-pagination-php-mysql/ It is oop pagination using mysqli. I only know mysqli and procedural. So, teach me to convert it to procedural. My procedural style code is this alongside their OOP: <?php if (!$conn) { $error = mysqli_connect_error(); $errno = mysqli_connect_errno(); print "$errno: $error\n"; exit(); } // Get the total number of records from our table "students". $total_pages = $conn->query('SELECT * FROM browsing_histories')->num_rows; //I NEED HELP TO SUBSTITUTE TH
-
Folks, I got this pagination without PREP STMT working ABSOLUTELY FINE: <?php //Required PHP Files. include 'header_account.php'; //Required on all webpages of the Account. ?> <?php if (!$conn) { $error = mysqli_connect_error(); $errno = mysqli_connect_errno(); print "$errno: $error\n"; exit(); } //Grab Username of who's Browsing History needs to be searched. if (isset($_GET['followee_username']) && !empty($_GET['followee_username'])) { $followee_username = $_GET['followee_username']; if($followee_username !=
-
Why Query Fails To Pull All Data From Data Base ?
phpsane replied to phpsane's topic in PHP Coding Help
I spotted my error the other day. Should've been: if($followee_username != "followee_all" OR $followee_username != "followee_All"") -
Why Query Fails To Pull All Data From Data Base ?
phpsane replied to phpsane's topic in PHP Coding Help
Correction: This url should work: browsing_histories_v1.php?followee_username=followee_all&page_number=1 It should trigger: $query = "SELECT * FROM browsing_histories"; It should show all rows from the tbl. Correct ? What's wrong ? Puzzled! -
Why Query Fails To Pull All Data From Data Base ?
phpsane replied to phpsane's topic in PHP Coding Help
Neither the IF from here shows all rows: if($followee_username == "followee_all" OR "Followee_All") { $query = "SELECT * FROM following_histories"; echo "all"; $query_type = "followee_all"; $followed_word = "followee_all"; $follower_username = "$user"; } else { $query = "SELECT * FROM following_histories WHERE username = \"$followee_username\""; echo "$followee_username"; $query_type = "$followee_username"; $followed_word = "$followee_username"; $follower_username = "$user"; -
Hi, I want to pull data from db, where sometimes all rows and sometimes rows matching given "username". Here is my code: //Grab Username of who's Browsing History needs to be searched. if (isset($_GET['followee_username']) && !empty($_GET['followee_username'])) { $followee_username = $_GET['followee_username']; if($followee_username != "followee_all" OR "Followee_All") { $query = "SELECT * FROM browsing_histories WHERE username = \"$followee_username\""; $query_type = "followee_username"; $followed_word = "$followee_u
-
Counting Number of Rows Via COUNT() And Not num_rows
phpsane replied to phpsane's topic in PHP Coding Help
Cos, I thought maybe what I thought the answer was probably was not correct somewhere as I was still getting the error. I think I forgot to refresh my browser. You got a grip like a vice, haven't ya ? Yaa, won't let it go! Lol! May my backside be excused from your rottweiler bite ? Lol! But don't go away as I want to complete this script I have been working on since feb 2017 and release it tomorrow. I might have more questions on upcoming new threads. Stay tuned with me tonight. -
Counting Number of Rows Via COUNT() And Not num_rows
phpsane replied to phpsane's topic in PHP Coding Help
Yeah. I know. If you notice my scripts, the variables get created for first time in the bind_result. Anyway, good thing you still mentioned it to make sure I am aware of it. Am sure other newbies, who aren't aware of this, will learn from your comment. -
Counting Number of Rows Via COUNT() And Not num_rows
phpsane replied to phpsane's topic in PHP Coding Help
Error gone on my original script now. Thanks! $stmt_1 = mysqli_prepare($conn,"SELECT COUNT(sponsor_username) from users WHERE sponsor_username = ?"); mysqli_stmt_bind_param($stmt_1,'s',$sponsor_username); mysqli_stmt_execute($stmt_1); //Show error if 'users' tbl was not successfully queried". if (!$stmt_1) { echo "ERROR 1: Sorry! Our system is currently experiencing a problem loading this page!"; exit(); } else { m