-
Posts
1,029 -
Joined
-
Last visited
-
Days Won
16
Everything posted by gw1500se
-
<div class="section" style="<whatever css style you want>"> <?php if(isset($_SESSION['uid'])) { echo 'Hello,'; echo $_SESSION["uid"]; } ?> </div>
-
I'm not sure if this possible but I have a bunch on links on my page that are jpg files. When I click on the link it opens the image in a new window which is exactly what I want. However, I need that jpg to automatically resize as if there were an img style attribute: img { max-width=100%; height=auto; } Is there a way to do that without creating an HTML page for each JPG with an img tag in it? TIA.
-
This is really a MySQL question. I'm not a MySQL expert so I don't know where latitude and longitude come from. I assume they are columns in your data base. I've never used a calculated value for ORDER BY rather than a column value. In my scenario I don't store that in my database. I just pass the zip codes to the MapQuest API and get the distance when I need it. If it were me I'd put the zip codes in an array, then add the distances to that array from the API and sort the array on the distances.
-
Post your current code.
-
I do something similar and use the MapQuest API. You have to sign up for a key but it is free.
-
round(floatval($item['in_bytes'])/1000000,2); I used 'floatval' instead of 'intval' since that is what 'round' wants. The 2 gives 2 decimal places but you can use what you want.
-
Simply divide it by 1000000 then round to get the desired precision. You may need to use intval to make the string an integer first.
-
Here is a handy tool to validate your HTML.
-
If I understand, you are really using the wrong approach. You really want to use preg_match and a regular expression. I am not a regexp expert so you should ask tor the expression in the regexp forum.
-
How do I split a 'range' string into two lots?
gw1500se replied to simona6's topic in PHP Coding Help
$chunk is whatever you name the array you split into. RTFM. -
How do I split a 'range' string into two lots?
gw1500se replied to simona6's topic in PHP Coding Help
$array1=$chunk[0]; $array2=$chunk[1]; Assuming it was split into 2 chunks. -
How do I split a 'range' string into two lots?
gw1500se replied to simona6's topic in PHP Coding Help
array_chunk -
Good catch. I missed that subtlety.
-
You need to change your loop from a while to a for. for(i=0; i<$rowCountUpdate; i++) What seems strange to me is that you are not changing your query parameters on each pass. It looks like you are always updating the same row thus the infinite loop.
-
Href - use id of href & concatenation inside loop.
gw1500se replied to JonnyDriller's topic in PHP Coding Help
Your syntax was just messed up. You can see how much simpler Barand's code is. There are a couple of ways to do the same thing but none are complicated. When you find yourself adding too many quotes and other symbols you are probably on the wrong track. PHP recognizes anything that starts with $ as a variable and does substitution. If you need to have a string that starts with $ and do not want substitution then you need to escape (\) the $, thus \$whatever. -
You are not passing $Connection to the function so it is undefined. If you had errors turned on you would have seen that.
-
Get data from evert <tr> from external URL with file_get_contents()
gw1500se replied to aThomsson's topic in PHP Coding Help
https://www.php.net/manual/en/class.domnodelist.php -
First, please use the code icon (<>) and select PHP for your code. The formatter makes it much easier to read. As for your question, PHP has a function to handle json called json_decode. It will create and associative array so you can access whatever you need easily.
-
Best way to set up a "Checkout Transaction"?
gw1500se replied to SaranacLake's topic in PHP Coding Help
Excuse me but "all of the experts?" Bull$hit. Requinix IS an expert as well as Kicken. You would be foolish not to heed their advice and it sounds like you will be foolish. -
Why in the world would you store it that way in the first place? Thought it may work now, down the road who knows what kind of problems this will present. Now is the time to fix the schema so it makes sense.
-
I'm getting this error from a PDO connection
gw1500se replied to Michael_Baxter's topic in PHP Coding Help
You can't just copy code and necessarily expect it to work. You need to understand the code presented and then implement your own. -
I'm getting this error from a PDO connection
gw1500se replied to Michael_Baxter's topic in PHP Coding Help
Are you logging in using the same user (root)? Also is the PHP script running on the same server as MySQL (localhost)? -
I'm getting this error from a PDO connection
gw1500se replied to Michael_Baxter's topic in PHP Coding Help
Perhaps not so obvious. The error message indicates that the database it is trying to open is 'lr'. If the global was returning something different, it would not show up that way in the error message. That database must not exist at least in the way it is being referenced. Again a 'show databases' would verify that.