-
Posts
6,906 -
Joined
-
Last visited
-
Days Won
99
Everything posted by ginerjm
-
What is being output is the warning message. Fix that and then see what happens
-
First let's be sure that you have php error checking enabled. Add this to the beginning of your php code error_reporting(E_ALL); ini_set('display_errors', '1'); That will help. Tell us what you get.
-
what would be the best way to store images for a dynamic slideshow.
ginerjm replied to alexandre's topic in PHP Coding Help
Legit? foundations? front display? Terms I am not familiar with. -
I'll tell you that I am not going to click on any website url. If you have code to be examined here, then post it. We are not here to diagnose entire websites. At least I don't think we are....
-
And if you are showing us code or error messages it is better to cut and paste it into a code window in this forum and not do "screenshots". That way if we want to help you we can edit the code and re-post it for you to then use.
-
What screenshots?
-
That Barand guy is pretty good, isn't he?
-
So Show us that script and mark the point where it seems to be stopping. You do realize that PHP lines do not get echoed. Only text and values created by PHP do.
-
How do you define a "stalled page"? Either it loads or it is just a blank screen. Not sure what a "stall" looks like. Do you get a 500 error at least? (or is that a 400?)
-
You added error handling for the db function calls but you should leave in the php error handling to point out syntax errors in your code until you move it into production. And I don't think you need the display startup errors setting if you are not actually Starting Php itself. Basically: error_reporting(E_ALL); ini_set('display_errors', '1'); Reset the 2nd line to '0' when you are not in development.
-
When you do an insert you don't reference the auto-increment field at all. You have specified 4 table columns but 5 values. Wrong.
-
Ok - ran your code and you have a data structure problem. Plus your function is FU. You can only execute ONE return statement in a function. As you have been told, once you return from a function that's it. Your first expression data works just fine with your function, using the first return of course. Your 2nd expression data is different than the first one. You have a 'children' array inside of the 2nd children element which your first one does not have. Your code fails when trying to navigate thru that data. Here's what the script gives to me: ( I have error checking turned on, hence the error message): Expression 1: Array ( [type] => add [children] => Array ( [0] => Array ( [type] => number [value] => 100 ) [1] => Array ( [type] => number [value] => 200 ) [2] => Array ( [type] => number [value] => 300 ) ) ) Expression 1 evaluates to: 600 Expression 2: Array ( [type] => add [children] => Array ( [0] => Array ( [type] => number [value] => 100 ) [1] => Array ( [type] => multiply [children] => Array ( [0] => Array ( [type] => number [value] => 2 ) [1] => Array ( [type] => add [children] => Array ( [0] => Array ( [type] => number [value] => 5 ) [1] => Array ( [type] => number [value] => 45 ) ) ) ) ) ) ) Notice: Undefined index: value in /home/albany/public_html/homejg/test.php on line 95 Notice: Undefined offset: 2 in /home/albany/public_html/homejg/test.php on line 96 Notice: Trying to access array offset on value of type null in /home/albany/public_html/homejg/test.php on line 96 Expression 2 evaluates to: 100 Expression 3: Array ( [type] => add [children] => Array ( [0] => Array ( [type] => number [value] => 1 ) [1] => Array ( [type] => fraction [top] => Array ( [type] => number [value] => 100 ) [bottom] => Array ( [type] => number [value] => 1000 ) ) ) ) Notice: Undefined index: value in /home/albany/public_html/homejg/test.php on line 95 Notice: Undefined offset: 2 in /home/albany/public_html/homejg/test.php on line 96 Notice: Trying to access array offset on value of type null in /home/albany/public_html/homejg/test.php on line 96 Expression 3 evaluates to: 1 This is line 95: $test1 = $expression['children'][1]['value'];
-
An echo statement sends data to the client screen usually. A function, given a set of arguments to work with, does something for you and literally returns a result in a certain format to the calling code. That mainline code then continues on with that value(s) where it may be used further or actually output, using an echo perhaps.
-
Your last post makes no sense at all. You can't write code that looks like that. Why are you storing this supposed code in a database table? Why not just write it? Why include braces in it when they are clearly not needed? As Barand has already said it appears that your supposed php code may be stored or retrieved through single quotes and not double ones, thus it does not get translated the way you want. So - what is our point in storing code in a table since you are clearly a noob at coding?
-
Procedural can be using mysqli or pdo. Think about it.
-
Perhaps you could find a way to echo out the actual query that gets run?
-
Using PDO?
-
This code: $link->link_url="details.php?id={$id}"; echo $link->link; Why is it like that? If you don't want to output something with braces in it, why do you assign the braces to it? And if you are making an assignment to a class var named 'link_url' why then do you output a var named 'link'? And if that url value is truly coming from a mysql database, why not update your database entry?
-
PHP PDO query within while loop only returns first row
ginerjm replied to johnc81's topic in PHP Coding Help
1 - never put a query inside of a loop. 2 - you are doing #1 and thus are wiping out your $stmt contents from the first quer by using it for your second query. -
I see you have error reporting turned OFF. Why? You should report ALL errors and have it turned on during development.
-
When using a function to set a value (which you are doing) one must return the value to the caller. Here is how I would do it. Note how I place the function definition below the code that is referencing it. I keep my functions out of the way of the main line code that does everything. $title = delivery_title(); ... ... ... function delivery_title() { $current_lang = get_locale(); if ($current_lang == 'fr_FR') return 'LIVRAISON'; else return 'DELIVERY'; } I could have set a variable in the function and then return that as the last line of it, but there was no need in this simple function.
-
And I asked - it is not part of your company's domain?
-
It is not located in the website's folder. Does that mean not part of your company domain?
-
It's not so much that we are trying to figure out your problem (you didn't tell us what it is) but more that we are trying to picture what your app is doing. Your need for a table to represent purchases and sales confuses me. I would simply have a user transaction table that saves a person's actions which would be tied to a users table where the user's account value may be stored. The tokens are your inventory that people buy and sell I assume. You do have multiple coluns named 'Id' which will be very confusing. Better that the name was a bit more creatively assigned. Maybe you might re-write your project's plans to make it clearer and then you could also tell us what your perceived problem.
-
OK so you are giving people access to a specific set of folders in your domain to save uploaded files to. 1 - each user has their own sub-tree of these folders that only they will access? 2 - how do you control which of the folders each upload goes into? 3 - will others be able to see each others tree contents?