[Solved] PHP – Find number in a string

[ad_1] For the second one, you could look for a line that starts with “10”, then “something” and then 9 consecutive spaces. After the spaces is what you need to capture. The regex is ^10.+\s{9}(.*) 1 [ad_2] solved PHP – Find number in a string

[Solved] How to print in PHP blank page

[ad_1] Unlike python, printing in php is done with the echo statement. In order to execute your code, you would do: <?php echo “Hello, World!”; ?> You can check out a great beginner tutorial on php here. <?php print(“Hello World”); ?> 0 [ad_2] solved How to print in PHP blank page

[Solved] INSERT row from another table using php PDO

[ad_1] Ok, so the issues you had/have were: $barCode = $GET[‘id’]); should have been $barCode = $GET[‘id’];, and possibly even $_GET[‘id’]; Your SELECT query selects the same field twice (SELECT Brand, Description, >Price<, Size, >Price<) You’re also inserting in the same field twice: INSERT INTO adstable (Brand, Description, >Price<, Size, >Price< You’re vulnerable to injection … Read more

[Solved] Get any user_id from Facebook url

[ad_1] You cannot get any Facebook’s User data using the Facebook API without the User’s explicit permission. The permission is granted to you (your APP) by the user in a popup window stating exactly what information you are receiving and with which permission type (read, write etc..) This is all for good reasons. 7 [ad_2] … Read more

[Solved] Get Weekends between two dates if present in php [duplicate]

[ad_1] This will do what you need, though you might want to tweak it to fit your project. <?php $date=”01-Aug-2018″; $date2 = ’07-Aug-2018′; $period = new DatePeriod( new DateTime($date), new DateInterval(‘P1D’), new DateTime($date2) ); $weekends = []; foreach ($period as $key => $value) { if ($value->format(‘N’) >= 6) { $weekends[$value->format(‘d-m-Y’)] = $value->format(‘D’); } } var_dump($weekends); … Read more

[Solved] OOP login page error [closed]

[ad_1] This is because function is outside the class. Should be <?php include(“config.php”); class User { //Db Connect public function __construct() { $db=new db_class(); } // Registration Process public function register_user($name,$username,$password,$email) { $password=md5($password); $sql=mysql_query(“select * from login where username=”$username” or emailid=’$email'”); if(mysql_num_rows($sql)==0) { $result=mysql_query(“insert into login(username,password,name,emailid) values(‘$username’,’$password’,’$name’,’$email’)”); return result; } else { return false; } … Read more

[Solved] Strange behavior with SELECT WHERE A=”$var” SQL [duplicate]

[ad_1] Since I raised the idea, I suppose I should illustrate the use of prepared statements. Using mysqli one would proceed as follows (assuming $connection has been successfully initialized): // The indentation here is purely a matter of personal preference $query = ‘SELECT business_name, vd.ID_Vendor, res.ID_RestaurantEstablishment FROM restaurant res INNER JOIN vendor_data vd ON vd.ID_Vendor … Read more