[Solved] Can Someone Explain me the below Code?

[ad_1] He created the Order.php to keep the class elements external from the main code. This is cleaner code and easier to maintain. and how can i store the Refrence of $order with the Object? You are already storing this in $newOrders? Added comments to each line for main.php <?php // these includes are just … Read more

[Solved] How to make an Instant Shorten link for a url shortener

[ad_1] Usually a bookmarklet something like this is used: javascript:u=encodeURIComponent(location.href);s=”http://urlshortener.com/shorten.php?url=”+u;window.open(s,’shortened’,’location=no,width=400,height=300′); That takes the URL of the current page and opens a new window pointing to urlshortener.com/shorten.php?url=[the url to be shortened]. The code used by YOURLS is more complicated, but probably does approximately the same thing. You just need to change the URL that the new … Read more

[Solved] Can I improve my PDO method (just started)

[ad_1] catch(PDOException $e) { echo ‘<p class=”error”>Database query error!</p>’; } I would use the opportunity to log which database query error occurred. See example here: http://php.net/manual/en/pdostatement.errorinfo.php Also if you catch an error, you should probably return from the function or the script. if ($STH) { // does this really need an if clause for it … Read more

[Solved] Why this mmediately invoked functions is not working properly

[ad_1] First off, I notice two problems: You have a syntax error in the parameter list to $.post You probably don’t want to do this: setTimeout(chatcom_load_one(id), 1000); Here’s an updated version of your code with these errors fixed: function chat_com_one(id) { $(‘#chatcom’).show(‘fast’); (function chatcom_load_one(id) { $.post(‘sendchat2.php’, { option: ‘chatcom_load_one’, tocom: id }, function (data) { … Read more

[Solved] How to combine two string in PHP?

[ad_1] $data = “{$username}_Deleted_$var”; or $data = $username.”_Deleted_”.$var; . is in php symbol for concatenating strings, { and } used in string means that anything between this symbol is a variable. 1 [ad_2] solved How to combine two string in PHP?

[Solved] You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘WHERE `id` [closed]

[ad_1] you should surround your variable with quotes ”, simply change to WHERE `id` = ‘” .$id.”‘”) As suggested you can’t use WHERE in INSERT queries but you should use an UPDATE query so you syntax should look like this: $result = mysql_query(“UPDATE cafes set deal=”$deal” WHERE `id` = ‘” .$id.”‘”) or die(mysql_error()); Then I … Read more