-
Posts
24,563 -
Joined
-
Last visited
-
Days Won
822
Everything posted by Barand
-
The only place that the code has a chance of running is in your own environment. Are you expecting everyone to have a database with your tables and table structures, to name just one obstacle?
-
Don't you think it could be the output from print_r()?
-
Try echo '<pre>' . print_r($row, true) . '</pre>'; to see what indexes $row does have. (Note - they are case-sensitive)
-
So, problem solved then.
-
Can’t add kitchen with this codeigniter script
Barand replied to matteo's topic in PHP Coding Help
TLDR Put code in a code element (or two or more if there are separate code elements) when posting - use the code button () Tell us what symptoms you get. What is happening or not happening? Limit the code you post to the bits that are relevant - no one is going to wade through all that. -
Does your bandstage table have a record with 281 in the id column?
-
ginerjm is asking you to echo the query string that you are trying to execute That is... $sql = "DELETE FROM bandstage WHERE id = $mybandid"; echo $sql; // ADD THIS TO SEE IF IT LOOKS AS EXPECTED
-
Add mysqli_report(MYSQLI_REPORT_ERROR|MYSQLI_REPORT_STRICT); before your call to "new mysqli"
-
The "r" and the "s" are table aliases, not realy neccessary here (force of habit) but are useful if you have columns in different table with the same name. Suppose reps and sales both had columns called "id"; you could then differentiate between them by either reps.id and sales.id or by using the aliases r.id and s.id, which is quicker to write. Occasionally you may wish to reference the same table twice or more in a query in which case the alias is essential EG TABLE : people ------------------------------ id int primary key name varchar father_id int foreign key mother_id int foreign key ------------------------------ SELECT p.id , p.name as person , f.name as father , m.name as mother FROM people p JOIN people f ON p.father_id = f.id JOIN people m ON p.mother_id = m.id
-
Try SELECT rep_id , rep_name , sales_id , sales_ticketnr FROM reps r JOIN sales s ON r.rep_id = sales_rep_id WHERE rep_touroperatorid = 5
-
It helps us immensely if you tell us your table structures when asking about joins
-
???
-
Sorry, I forgot to take the "->fetchAll()" from the end. Let's start again $stmt = $db->prepare("SELECT * FROM posts WHERE username = ? LIMIT $paginationStart, $limit"); $stmt->execute([$row2['username']]); $authors = $stmt->fetchAll();
-
Use "prepare" as alternative to "query", not both. $authors = $db->prepare("SELECT * FROM posts WHERE username = ? LIMIT $paginationStart, $limit")->fetchAll(); $authors->execute([$row2['username']]); to get your count of the records, you can $sql = $db->query("select count(*) from posts"); $allRecords = $sql->fetchColumn();
-
VARCHAR columns aren't limited to 255 characters From manual (https://dev.mysql.com/doc/refman/5.7/en/char.html) ...
-
The names do not have to be the same, although it does make relationships clearer if they are. What matters is the value in the columns as that is what is used to match a record in a table to one or more related records records in another table. Before using a database, the tables in it should be normalized. Looking at your tables, that term is something new to you and your whole design is bad need of repair. The correct design of your data makes life a lot easier further down the road. There is a link to an SQL tutorial in my signature that may help you.
-
Perhaps errors are being logged instead of displayed. Check error logs.
-
In your PHP code, if the total is 0, output the button, otherwise don't.
-
Where does the above data come from then?
-
You can't call a javascript function from PHP. Javascript runs on the client after php has finished running on the server.
-
Because it uses "SELECT * ... " it tells us nothing about what the keys are in the returned array. They will be the same as the column names, but we don't know the user table structure.
-
Did you check what the find_by_id() function wasputting in the array?
-
If I understand your data, set the editor role status to 0 to block all editors. roles_table id role role_status -------------------------------------- 1 Admins 1 2 Editors 0 3 Users 1 UPDATE roles SET role_status = 0 WHERE id = 2;
-
What Would You Like To See In Tomorrow's 2023 SearchEngine ?
Barand replied to TheStudent2023's topic in Miscellaneous
I'm too bored by your posts to care what you do or how you do it. -
Your $current_user array does not have an index 'role_status' and that is causing the error. It does have an index 'status' which may be the one you should be using. You should verify this by looking at your find_by_id() function to see what it is putting into the array.