Posts

Showing posts with the label mysqli

Having a problem getting mysqli_query to execute

Having a problem getting mysqli_query to execute Here's the problem: I started a swap today to use mysqli. No biggie, just had to change a few statements. Everything went fine, no errors... Except that I can't get it to execute any queries at all. I have double and triple checked my syntax. I even started creating situations where it SHOULD return an error (Trying to get it to INSERT to Tables that don't exist or with values that exceeded column limits or didn't match type) and... nothing. It doesn't return an error, it doesn't write. It WILL complain if parameter one is NOT a mysqli type. Here's the relevant code: $con = mysqli_connect("localhost", "root", "","test"); if (mysqli_connect_errno()) { printf("Connect failed: %sn", mysqli_connect_error()); exit(); } $query = "INSERT INTO files VALUES (NULL, 5, 'hello')"; mysqli_query($con, $query); And nothing. It runs without a problem, but it ...

how can i fetch the people i follow but they don't follow back?

how can i fetch the people i follow but they don't follow back? so i have a table called follow_sys with three columns id and follower and following containing the usernames of followers and followed ,so i want to fetch all of the followers i follow but they don't follow me back, how can i do that ? follow_sys id follower following i tried a self join but it didn't work, i'm confused $sqlFollowing = "SELECT * from follows_syds t1 join follows_syds t2 on t1.follower != t2.following where t1.follower = ? group by t1.id"; $Following = $conn -> prepare($sqlFollowing); $Following -> bind_param('s',$getUser); $Following -> execute(); $FollowingGET = $Following -> get_result(); $FollowingRows = $FollowingGET -> num_rows; while($b = $FollowingGET -...

How can convert my PC to online server?

How can convert my PC to online server? I have made an android app that can connect to MySQL database via online server url. Now, I want to connect the app to MySQL database on my PC instead of the online server. I have searched the internet, and recommendations were to use No-IP software for Dynamic DNS and forward port 3306 in router's configuration page. then, use an online host like 000webhost.com, I have done all of this, but I still don't know how to link my PC to the free domain I acquired on the internet? the input to my android app should be like String ServerURL = "http://mydomain.000webhost.com/get_data.php" ; I have the get_data.php file on my PC, how can I connect it to the online host. Update thank you alexandre for your help. I opened port 80 on my PC inbound/outbound rules, and this is my NAT page in the router config. page, can you tell how should I fill these fields? 1 Answer 1 ...

PHP - Replace characters in a string

PHP - Replace characters in a string I have read a number of articles on str_replace() on here and other resources, and not found the answer to my problem. str_replace() Here’s the string I have a problem with which is stored in $title ... $title Paul McCartney's Theme From The Film "The Honorary Consul” Here’s the code I’m using ... str_replace(‘“‘,’ ‘,$title); str_replace(‘“‘,’ ‘,$title); For some reason, the code above is completely ignoring this string, and a number of others similar. I think it may be because of the Apostrophe as the above code works fine for strings which don’t have apostrophe’s as part of the text. I need to keep the apostrophe in the title, but I’m not so worried about the “ However, if someone can suggest a way to keep both, in the same string, and add the whole string in a MySQL INSERT command string, that would be the best result for me. MySQL INSERT USE PREPARED PDO STATEMENTS!!!! You don't need to worry about thi...

SQL Return NULL if not found in table, instead of No Result

SQL Return NULL if not found in table, instead of No Result I have two tables that contain prices for products. Those are product_pricing.price AS price2 and products.price AS price1 . product_pricing.price AS price2 products.price AS price1 If price2 is set, I'll use that. However if it isn't I'll stick with price1 . price2 price1 SELECT `products`.`wo_id`, `products`.`fty_id`, `products`.`price` AS price1, `product_attributes`.`fty_id`, `product_attributes`.`cat_id`, `product_attributes`.`design_id`, `product_attributes`.`season_id`, `products_u_ids`.`u_id`, `products_u_ids`.`link_id`, `product_designs`.`design_id`, `product_designs`.`brand_id`, IFNULL(`product_pricing`.`u_id`, NULL), IFNULL(`product_pricing`.`currency`, NULL) AS price2_currency, IFNULL(`product_pricing`.`price`, NULL) AS price2, IFNULL(`product_pricing`.`formula_id`, NULL), ...