jazzman1
Staff Alumni-
Posts
2,713 -
Joined
-
Last visited
-
Days Won
12
Everything posted by jazzman1
-
PHP PDO variable not working in query but static value works
jazzman1 replied to ArshSingh's topic in PHP Coding Help
Sorry for the delay I wasn't at home. Are you absolutely sure that you have only one table called - "members" in this local db server? Can I also see your database credentials? There is nothing wrong with the structure in this screenshot. -
PHP PDO variable not working in query but static value works
jazzman1 replied to ArshSingh's topic in PHP Coding Help
we need to see the result of show columns! -
PHP PDO variable not working in query but static value works
jazzman1 replied to ArshSingh's topic in PHP Coding Help
Can I see the output of: SHOW FULL COLUMNS FROM members Run this statement via your mysql gui tool, phpmyadmin, mysql workbench or whatever you want. PS: Are you sure you're working on your local machine and your db server is a local one? -
PHP PDO variable not working in query but static value works
jazzman1 replied to ArshSingh's topic in PHP Coding Help
Then the user_id column in your database / table is a char type instead integer. Change the type and try again. -
PHP PDO variable not working in query but static value works
jazzman1 replied to ArshSingh's topic in PHP Coding Help
That doesn't really matter. The output is string(1) "5". Do you get the same output to those 2 variables: public function profile_view($user_id = null) { // here var_dump($user_id); $user = $user_id; // and here var_dump($user); exit ............................... } -
PHP PDO variable not working in query but static value works
jazzman1 replied to ArshSingh's topic in PHP Coding Help
The above output is 5. It should be integer, but anyway Can you do a var_dump() of the GET variable? Do you have an empty space before or after 5 in the form input field? That's way I wanted to do var_dump(). -
PHP PDO variable not working in query but static value works
jazzman1 replied to ArshSingh's topic in PHP Coding Help
Now, it should work properly. -
PHP PDO variable not working in query but static value works
jazzman1 replied to ArshSingh's topic in PHP Coding Help
I want you to do a var_dump() of the value of $user_id in this function (method). Something like: public function profile_view($user_id = null) { // here var_dump($user_id); exit; $user = $user_id; $stmt = $this->_db->prepare('SELECT memberID,username,email,profile_pic,active FROM members WHERE memberID = :user_id AND active="YES"'); $stmt->execute(array(':user_id'=>$user)); while($row = $stmt->fetch(PDO::FETCH_ASSOC)) { $user_det = (object) array('username'=> $row['username'],'email'=>$row['email'],'profile_pic'=>$row['profile_pic'],'id'=> $row['memberID'],'active'=>$row['active']); return $user_det; } } // or public function profile_view($user_id = null) { // here var_dump($user_id); $user = $user_id; // and here var_dump($user); exit; $stmt = $this->_db->prepare('SELECT memberID,username,email,profile_pic,active FROM members WHERE memberID = :user_id AND active="YES"'); $stmt->execute(array(':user_id'=>$user)); while($row = $stmt->fetch(PDO::FETCH_ASSOC)) { $user_det = (object) array('username'=> $row['username'],'email'=>$row['email'],'profile_pic'=>$row['profile_pic'],'id'=> $row['memberID'],'active'=>$row['active']); return $user_det; } } PS: Copy / paste the exact output from what you're getting in the document / html page. -
PHP PDO variable not working in query but static value works
jazzman1 replied to ArshSingh's topic in PHP Coding Help
Can you show us that result? -
Merry Christmas to you, too!
-
Start from here: // html code <input id="Email" name="Email" placeholder="Your Email Address" class="form-control input-md" required="" type="text"> // php code if(isset($_POST['email'])) { }
-
Interesting. What is your real domain name xxxx.com.br or xxxx.srv.br? Is this your domain (webmail.telecel.srv.br) [jazz@centos-box ~]$ nmap --script smtp-open-relay.nse -p 25,465,587 webmail.telecel.srv.br Starting Nmap 5.51 ( http://nmap.org ) at 2014-12-22 07:38 EST Nmap scan report for webmail.telecel.srv.br (177.185.197.65) Host is up (0.20s latency). PORT STATE SERVICE 25/tcp filtered smtp 465/tcp closed smtps 587/tcp closed submission Nmap done: 1 IP address (1 host up) scanned in 2.36 secon if so the ports 465 and 587 are closed. You need to tell us
-
Finding name of last created file on smb server
jazzman1 replied to tonyio's topic in PHP Coding Help
I am not familiar with this php class at all, but have experience with samba servers (by the way, actually this is not a samba server). Have you tried to establish a connection using smbclient from your Unix machine? -
$mysqli->commit() returns false , but it is working!
jazzman1 replied to invader7's topic in PHP Coding Help
In this example, the auto-commit mode is disabled, so no SQL statements are committed until you call the method commit explicitly. To be more precise, according the docs the default is for a SQL statement to be committed when it is completed, not when it is executed. That's a normal behaviour for the InnoDB engine. -
$mysqli->commit() returns false , but it is working!
jazzman1 replied to invader7's topic in PHP Coding Help
works for me. what db engine are you using? -
$mysqli->commit() returns false , but it is working!
jazzman1 replied to invader7's topic in PHP Coding Help
Hm...it's weird...works fine for me. The script returns bool(true). //EDIT:: Like this? <?php $mysqli = new mysqli("::1", "lxc", "password", "test"); if ($mysqli->connect_errno) { echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error; } //$mysqli->autocommit(FALSE); $stmt = $mysqli->prepare("INSERT INTO test.users (first_name,last_name) VALUES ('stelios','stelios2')"); $stmt->execute(); $stmt->close(); $stmt = $mysqli->prepare("INSERT INTO test.users (first_name,last_name) VALUES ('stelios3','stelios4')"); $stmt->execute(); $stmt->close(); //var_dump($mysqli->commit()); $mysqli->close(); -
Here-doc. $msg = <<<EOD Example of string containing spacial (',", chars using heredoc syntax. EOD; echo $msg;
-
Finding name of last created file on smb server
jazzman1 replied to tonyio's topic in PHP Coding Help
also, you need to make sure that the default (139) port to this microsoft machine is opened to use: nmap -Pn -p 139 --open 10.1.1.10 nmap is a great tool. -
Then you don't have to use two cron jobs. In my example below my regular user (jazzman) sets up a command to be run by cron every Sunday (day 7) at 00:01 AM. 1 0 * * 7 /usr/bin/php -f Start.php The cron task will be finished at Sunday 23:59. Or you want to run the script every minute? Anyways... you don't need to use cronjob here if I understand correctly your wishes. Just create your start.php file with the following data, then include it to the display php file. start.php <?php // set the default timezone to use. date_default_timezone_set('America/Toronto'); $curr_d = date("l"); function displayMessage($day) { if($day != 'Sunday') { return null; } else { return "Today is Sunday"; } } echo displayMessage($curr_d); display.php include('start.php');
-
The default behaviour of the php.ini file would be easily changed using apache .htaccess hidden files somewhere on the web hosting directories. Have you checked for error messages in the apache error log file? How about to check the same form's values using a different language let's say bash or perl?
-
Thanks anyway, Barry! it's not an important thing.
-
why don't you change the default date and timezone in the entire server rather in application level?
-
No. They are not the same only the column data type. It was just a coincidence.
-
Friends, I have the following table: SELECT * FROM tbl1; +----+-------+-------+ | id | col_1 | col_2 | +----+-------+-------+ | 1 | 1 | NULL | | 2 | 2 | 2 | | 3 | NULL | 3 | | 4 | 4 | NULL | +----+-------+-------+ 4 ROWS IN SET (0.00 sec) So, if I wanna update only the null values of col_2 with these from col_1 or vice versa I'm running the following update statement with mysql ifnull() func. mysql> UPDATE test.tbl1 t1 SET t1.col_2 = ifnull(t1.col_2, t1.col_1), t1.col_1= ifnull(t1.col_1, t1.col_2); Query OK, 3 ROWS affected (0.06 sec) ROWS matched: 4 Changed: 3 Warnings: 0 Is there a way to use LEFT JOIN to get all null values from every columns and rows, then to update the columns in the same way? I notice that the sub-query failed for me within an update statement.