[Solved] query() to a non-object

replace $link->query($update); with mysql_query($update, $link); because $link is a Mysql link identifier, it have no any methods. use http://php.net/manual/en/function.mysql-query.php instead. and yea.. its deprecated 0 solved query() to a non-object

[Solved] Undefined Index in php (I’ve searched all over internet, and stackoverflow, tried almost everything) [duplicate]

Use this query. if(isset($_POST[‘txtSpace’])) { $choice_spc_port = $_POST[‘txtSpace’]; } if(isset($_POST[‘txtLocation’])) { $choice_loc = $_POST[‘txtLocation’]; } $insert = mysql_query(“INSERT INTO dbForm (db_space_portion, db_animal_location) VALUES (‘{$choice_spc_port}’, ‘{$choice_loc}’)”); solved Undefined Index in php (I’ve searched all over internet, and stackoverflow, tried almost everything) [duplicate]

[Solved] Log out from site [closed]

You should be checking if a session variable exists to grant access to users. To log out from your site, simply destroy the session, this will prevent access effectively ‘logging’ the user out: session_start() session_destroy(); //destroy sessions but session data will still be avail on same page so redirect is needed after this header(‘location:index.php’); // … Read more

[Solved] adddate(curdate(), -(day(curdate())-1)) and concat(last_day(curdate()),’ 23:59:59′) [closed]

DAY(CURDATE())-1 is the current day of the month, less 1. For today (Aug 15, 2013), the value would be 14. Subtract 14 days from August 15 and you have August 1. In other words, ADDDATE(CURDATE(), -(DAY(CURDATE())-1)) gives you the first day of the month. LAST_DAY(CURDATE()) gives you the last day of the month. If you … Read more

[Solved] php mail form doesn’t work [closed]

The below now works. It’s just small syntactic mistakes, you had a few additional ; and this line is wrong and presumably a mistake: $subject = $email = $_POST[‘subject’]; I also moved the function outside of the if statement…it’s not incorrect to have it there, it just looks a bit weird. function clean_text($string) { $bad … Read more

[Solved] Validation Form with PHP or Javascript [closed]

if the visitor fills out a field phone then allowed only enter numbers. and if the visitor fills out a field phone then allowed only enter email. Check this out function validateForm(){ var x = document.getElementById(‘name’); var email = document.getElementById(’email’); var num = document.getElementById(‘number’); var size = document.getElementById(‘size’); var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; var atpos=email.value.indexOf(“@”); var … Read more

[Solved] need regex for youku video id [closed]

here’s how i would do it. id in first capture group. youku\.com/(?:player.php/sid/|v_show/id_)([a-zA-Z0-9]+)(?:/|\\.) i understand now that you use php as application language, which changes things a bit. you have to start and end the regular expression with a formality character of your own choice. for this regular expression i’d use the hash character, since it’s … Read more

[Solved] How to get the value which user has selected in php?

<?php if($_POST[‘select’]){ // Storing selected value in a variable $selectedValue= $_POST[‘holiday’]; if ($selectedValue == ‘month’) { } else if ($selectedValue == ‘day’) { } else{ echo “Lalalala”; } } ?> solved How to get the value which user has selected in php?

[Solved] Can I use an if on foreach in such a case? [closed]

As was said, if you’re merely going to skip the record then you may as well not retrieve them in the first place (and thus incur the overhead for having to extract them into PHP memory, etc): SELECT * FROM `your_table` WHERE `gender` = ‘female’ AND `taken` = `available`; However, if you have a specific … Read more

[Solved] get week number and day from date

$input = new \DateTime(‘2017-07-17’); $firstDayOfMonth = new \DateTime($input->format(‘Y-m-01’)); $order = (int)(($input->format(‘j’) – 1) / 7) + 1; function ordinal($number) { $ends = array(‘th’,’st’,’nd’,’rd’,’th’,’th’,’th’,’th’,’th’,’th’); if ((($number % 100) >= 11) && (($number%100) <= 13)) return $number. ‘th’; else return $number. $ends[$number % 10]; } echo ordinal($order).’ ‘.$input->format(‘l’); You can tinker with the code at https://3v4l.org/dg5Xa 2 … Read more