ajetrumpet Posted October 14, 2019 Share Posted October 14, 2019 is it true that all the server side code runs before the client side code when accessing a webpage? if that is true, what about PHP code that is embedded inside HTML tags? wouldn't that result in an error a lot of times? Quote Link to comment https://forums.phpfreaks.com/topic/309370-server-side-vs-client-side/ Share on other sites More sharing options...
ginerjm Posted October 14, 2019 Share Posted October 14, 2019 You certainly need to do some reading to get a grip on how these things work. PHP runs on the server and prepares the web page and the server then sends it to the client - with only HTML and JS/JQ code (and perhaps some other newer stuff) present. PHP code embedded in html tags is just there (on the server) to provide some data for the html to display (although I prefer to embed php vars rather than actual code). The webpage may have some js/jq code that gets triggered by events that happen at the client level. Eventually the html gets triggered to submit the page and its entries back to the server, triggering perhaps another PHP script (or the same one again) to run on the server and process the inputs received from the client. Don't confuse the two. Basically it's "PHP on the server; JS/JQ on the client". Quote Link to comment https://forums.phpfreaks.com/topic/309370-server-side-vs-client-side/#findComment-1570634 Share on other sites More sharing options...
Barand Posted October 14, 2019 Share Posted October 14, 2019 (edited) The PHP code embedded inside html tags is just generating more html code dynamically (usually containing data extracted from a database) which becomes part of the overall html page. This then received by the browser (PHP's job is now done) on the client and rendered to display on the screen. EDIT: Your PHP code may look something like this <html> <body> <table border='1'> <tr> <th>IP ADDRESS</th> <th>PAGE VISITED</th> <th>PREVIOUS PAGE</th> <th>DATE</th> <th>TIME</th> </tr> <?php // printing table rows while($row = mysqli_fetch_row($sql)) { echo '<tr>'; foreach ($row as $col) { echo "<td>$col</td>"; } echo "</tr>\n"; } ?> </table> </body> </html> and what your browser then receives is something like this <html> <body> <table border="1"> <tr> <th>IP ADDRESS</th> <th>PAGE VISITED</th> <th>PREVIOUS PAGE</th> <th>DATE</th> <th>TIME</th> </tr> <tr><td>111.222.001.123</td><td>a.php</td><td>N/A</td><td>10/11/19</td><td>9:00am</td></tr> <tr><td>111.222.001.123</td><td>a.php</td><td>N/A</td><td>10/12/19</td><td>8:00am</td></tr> <tr><td>111.222.001.123</td><td>a.php</td><td>xyz</td><td>10/12/19</td><td>12:00pm</td></tr> <tr><td>111.222.001.123</td><td>a.php</td><td>N/A</td><td>10/12/19</td><td>1:00pm</td></tr> </table> </body> </html> Edited October 14, 2019 by Barand Quote Link to comment https://forums.phpfreaks.com/topic/309370-server-side-vs-client-side/#findComment-1570635 Share on other sites More sharing options...
ajetrumpet Posted October 14, 2019 Author Share Posted October 14, 2019 ok guys I think I understand. thanks for setting me strait. Quote Link to comment https://forums.phpfreaks.com/topic/309370-server-side-vs-client-side/#findComment-1570638 Share on other sites More sharing options...
ginerjm Posted October 14, 2019 Share Posted October 14, 2019 straight Quote Link to comment https://forums.phpfreaks.com/topic/309370-server-side-vs-client-side/#findComment-1570639 Share on other sites More sharing options...
ajetrumpet Posted October 14, 2019 Author Share Posted October 14, 2019 20 minutes ago, ginerjm said: straight you guys are suppose to be coding specialists, not grammar specialists! Quote Link to comment https://forums.phpfreaks.com/topic/309370-server-side-vs-client-side/#findComment-1570641 Share on other sites More sharing options...
requinix Posted October 14, 2019 Share Posted October 14, 2019 *You, supposed We can be both 😉 Quote Link to comment https://forums.phpfreaks.com/topic/309370-server-side-vs-client-side/#findComment-1570642 Share on other sites More sharing options...
ajetrumpet Posted October 14, 2019 Author Share Posted October 14, 2019 can you come over and clean my house too? 😀 Quote Link to comment https://forums.phpfreaks.com/topic/309370-server-side-vs-client-side/#findComment-1570643 Share on other sites More sharing options...
Barand Posted October 14, 2019 Share Posted October 14, 2019 $50 per hour plus travel time and expenses Quote Link to comment https://forums.phpfreaks.com/topic/309370-server-side-vs-client-side/#findComment-1570644 Share on other sites More sharing options...
requinix Posted October 14, 2019 Share Posted October 14, 2019 Be careful of Barand's quote: $50 is pretty good for an hourly rate - it's the travel costs that'll really get you. Quote Link to comment https://forums.phpfreaks.com/topic/309370-server-side-vs-client-side/#findComment-1570645 Share on other sites More sharing options...
Barand Posted October 14, 2019 Share Posted October 14, 2019 That's sabotaged my freebie hoilday to the States Quote Link to comment https://forums.phpfreaks.com/topic/309370-server-side-vs-client-side/#findComment-1570646 Share on other sites More sharing options...
requinix Posted October 14, 2019 Share Posted October 14, 2019 I know things are Slightly Unpleasant over there, but coming over here would be one of those "out of the fire, into the frying pan" things. Canada seems nice though. Quote Link to comment https://forums.phpfreaks.com/topic/309370-server-side-vs-client-side/#findComment-1570647 Share on other sites More sharing options...
Barand Posted October 14, 2019 Share Posted October 14, 2019 But as Mark Twain (?) commented "Canada's OK but not for the whole weekend" Quote Link to comment https://forums.phpfreaks.com/topic/309370-server-side-vs-client-side/#findComment-1570648 Share on other sites More sharing options...
requinix Posted October 14, 2019 Share Posted October 14, 2019 H. H. Munro, aka Saki. Took me a while to find it. Quote Link to comment https://forums.phpfreaks.com/topic/309370-server-side-vs-client-side/#findComment-1570650 Share on other sites More sharing options...
Barand Posted October 14, 2019 Share Posted October 14, 2019 I knew someone said it 😊 Quote Link to comment https://forums.phpfreaks.com/topic/309370-server-side-vs-client-side/#findComment-1570651 Share on other sites More sharing options...
ajetrumpet Posted October 14, 2019 Author Share Posted October 14, 2019 1 hour ago, Barand said: $50 per hour plus travel time and expenses that's ridiculous Barand! custodians over here earn anywhere from $9 USD to $12 USD. Given your age, I would say you're retired by now? What in the world do you need anymore money for!? Quote Link to comment https://forums.phpfreaks.com/topic/309370-server-side-vs-client-side/#findComment-1570653 Share on other sites More sharing options...
requinix Posted October 14, 2019 Share Posted October 14, 2019 35 minutes ago, ajetrumpet said: that's ridiculous Barand! custodians over here earn anywhere from $9 USD to $12 USD. So you're saying you can find a custodian for $12 who will come clean your house for you? Quote Link to comment https://forums.phpfreaks.com/topic/309370-server-side-vs-client-side/#findComment-1570654 Share on other sites More sharing options...
ajetrumpet Posted October 14, 2019 Author Share Posted October 14, 2019 (edited) 15 minutes ago, requinix said: So you're saying you can find a custodian for $12 who will come clean your house for you? not for cleaners that run their own businesses. however, companies that clean homes generally hire employees at that rate, yes. Edited October 14, 2019 by ajetrumpet Quote Link to comment https://forums.phpfreaks.com/topic/309370-server-side-vs-client-side/#findComment-1570655 Share on other sites More sharing options...
Barand Posted October 14, 2019 Share Posted October 14, 2019 57 minutes ago, ajetrumpet said: What in the world do you need anymore money for!? Petrol (gas) and insurance to run my 5L (305 cu.in) car Quote Link to comment https://forums.phpfreaks.com/topic/309370-server-side-vs-client-side/#findComment-1570656 Share on other sites More sharing options...
ajetrumpet Posted October 14, 2019 Author Share Posted October 14, 2019 what amount of cylinders does 5L equate to? I hear petrol in England is pretty expensive. Quote Link to comment https://forums.phpfreaks.com/topic/309370-server-side-vs-client-side/#findComment-1570657 Share on other sites More sharing options...
Barand Posted October 14, 2019 Share Posted October 14, 2019 (edited) It's a Mercedes CLK 500 V8 coupe. About $8 (6.30 GBP) per gallon. Mine does around 12 miles / gallon around town Edited October 14, 2019 by Barand Quote Link to comment https://forums.phpfreaks.com/topic/309370-server-side-vs-client-side/#findComment-1570658 Share on other sites More sharing options...
ajetrumpet Posted October 14, 2019 Author Share Posted October 14, 2019 that's horrible. I drove a Toyota Yaris for years. 40 mpg for those guys! Only the hybrids get better than that! But i totaled all 3 yarises in 3 years time. hit a deer with each one. those are easy to damage tho...made of plastic. Mercedes Benz cars...now those are tanks! steel enforced! Quote Link to comment https://forums.phpfreaks.com/topic/309370-server-side-vs-client-side/#findComment-1570660 Share on other sites More sharing options...
ginerjm Posted October 14, 2019 Share Posted October 14, 2019 Actually it was a 'spelling' correction. Not grammar. Just didn't want you to repeat the same mistake... Quote Link to comment https://forums.phpfreaks.com/topic/309370-server-side-vs-client-side/#findComment-1570662 Share on other sites More sharing options...
Barand Posted October 14, 2019 Share Posted October 14, 2019 2 hours ago, ajetrumpet said: hit a deer with each one. those are easy to damage tho...made of plastic You have plastic deer? We have concrete cows in Milton Keynes... Quote Link to comment https://forums.phpfreaks.com/topic/309370-server-side-vs-client-side/#findComment-1570663 Share on other sites More sharing options...
ajetrumpet Posted October 14, 2019 Author Share Posted October 14, 2019 12 minutes ago, Barand said: You have plastic deer? We have concrete cows in Milton Keynes... very funny dude. great picture! here's what we have here: Quote Link to comment https://forums.phpfreaks.com/topic/309370-server-side-vs-client-side/#findComment-1570664 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.