[Solved] Parse error: syntax error, unexpected T_STRING, expecting ‘,’ or ‘;’ for echo statement with variables [closed]

You have several problems with your line. echo “<td><form action=\”del_prod.php\” method=\”post\”><input type=\”checkbox\” name=\”product_id\” value=\””.$row[‘product_id’].”\” /></td>”; You’re not escaping the double quotes. You are missing the opening < on the input tag. You’re not closing the input tag. You’re not concatenating the $row[‘product_id’] in the string properly. You’re missing a semi-colon. This is all aside from … Read more

[Solved] PHP Local host running errors [closed]

Make the login button a part of a form, and have the form submit to index.php. The form will contain an empty input that tells the page that you have been logged out. For example: <form action = “https://stackoverflow.com/” method = ‘post’> <input style=”display: none;” name=”logout” value=”logoutTrue”> <input type = “submit’ value=”Logout”> </form> Next, a … Read more

[Solved] What is this theme code doing? [closed]

Clearly mentioned – get_terms() retrieve the terms in taxonomy or list of taxonomies. You need to learn more for action hooks in wordpress. The question is, can this code be somewhere useful ? You actually need to look in you theme whether it is providing any functionality/option on the basis of this hook. 3 solved … Read more

[Solved] Why in OOP you do everything in objects? [closed]

You choose object-oriented programming when encapsulating data and behavior into classes, whose instances, maps well onto the problem you’re trying to solve. Not every problem is best done with objects. There are other styles of programming – functional and declarative come to mind – that are also good. Most of the scientific programming that I … Read more

[Solved] How can I foreach this array object?

Here You go: <?php $list = (object)[]; $list->egame = [ (object)[‘platform_name’=>’TT’, ‘game’=>(object)[(object)[‘game_name’=>’game1’, ‘info’=>’test1’],(object)[‘game_name’=>’game2’, ‘info’=>’test2’],(object)[‘game_name’=>’game3’, ‘info’=>’test3’]]], (object)[‘platform_name’=>’TG’, ‘game’=>(object)[(object)[‘game_name’=>’game4’, ‘info’=>’test4’],(object)[‘game_name’=>’game5’, ‘info’=>’test5’]]], (object)[‘platform_name’=>’TBIN’, ‘game’=>(object)[(object)[‘game_name’=>’game6’, ‘info’=>’test6’]]] ]; foreach ( $list->egame as $eg ) { foreach ( $eg->game as $game ) { echo “game: ” . $game->game_name . ” info: ” . $game->info . “<br>”; } } ?> Edit #1 … Read more

[Solved] I can’t seem figure out how to update my last inlog time [duplicate]

In your query here: UPDATE users_table SET ‘date_last_inlog’ = NOW() WHERE user_name=”$user_name” Try removing the quotes around date_last_inlog or changing them to backticks: UPDATE users_table SET date_last_inlog = NOW() WHERE user_name=”$user_name” Also, don’t use the mysql_* functions, use mysqli or PDO instead. Your code is vulnerable to SQL Injection. 9 solved I can’t seem figure … Read more

[Solved] How to stop form submission if email address is already available in MySQL db ? [closed]

To achieve this you will need ajax, you have two options on the username field you can have an onblur event, then call a function that will check the username in the database using the onblur event. <input name=”username” type=”text” id=”username” onBlur=”checkAvailability()”> The onblur event occurs when an object loses focus. The onblur event is … Read more

[Solved] Need Regular Expression for Format -xx-xxx-x- [closed]

<?php $url = “http://<hostname>/p/Brand-Product-Name-6118-161-1-gallery.jpg”; preg_match_all(‘#(\d+)-(\d+)-\d+-gallery\.jpg$#’,$url,$matches); // Depends on how accurate you want to be. You can go with many choices like: // preg_match_all(‘#http\://.*?/p/.*?(\d+)-(\d+)-\d+-.*\.jpg#’,$url,$matches); var_dump($matches); /* array(3) { [0]=> array(1) { [0]=> string(22) “6118-161-1-gallery.jpg” } [1]=> array(1) { [0]=> string(4) “6118” } [2]=> array(1) { [0]=> string(3) “161” } } */ 1 solved Need Regular Expression … Read more

[Solved] How to write an if(or switch) statement to check all the values of an array in one go in php [closed]

You can compare them like this: $testing = Array(true, true, true); if($testing == array(true, true, true)){ //do something }else if ($testing == array(true, true, false)){ //do something else } You don’t need to use the same variable $testing again. Just create a new array to compare it with. 1 solved How to write an if(or … Read more