jazzman1
Staff Alumni-
Posts
2,713 -
Joined
-
Last visited
-
Days Won
12
Everything posted by jazzman1
-
So, according the sql docs (feature ID F641) inserting multiple data of rows at a time is optional in SQL and MySQL server supports that, which is nice. I think the performance should be the same when you loop the whole bunch of insert statements or just looping only their values.But I want to mention few things about insert statement. It is always a good practice to name all columns into which you are inserting values because: 1) The INSERT statement is much more descriptive 2) You can verify that you are providing the values in the proper order based on the column names 3) You have better data independence. The order in which the columns are defined in the table does not affect your INSERT statement.
-
Image browse & upload not displaying using php
jazzman1 replied to Vinodpv's topic in PHP Coding Help
If the binary string is stored in a database as expected, your script should work properly. Try my script and add the header function with content-type to it. $result=mysql_query("select * from images where id = 26"); $row=mysql_fetch_assoc($result); header("Content-Type:image/jpeg"); echo $row['image']; Much better is to use application server store the images instead the database as Ch0cu3r already stated.It's also not recommended to use the old mysql extension for new development, use either the mysqli or pdo_mysql -
Image browse & upload not displaying using php
jazzman1 replied to Vinodpv's topic in PHP Coding Help
Can you post the output of: <?php $result=mysql_query("select * from images where id = 26"); while($row=mysql_fetch_assoc($result)) { echo $row['image'].'<br />'; echo $row['name']; } ?> Use the forum code [ code ] tags when providing code. -
All my linux machines use by default SHA-512 and one of them I set manualy to blowfish encryption method. Just out of curiosity (I'm not expert) what's wrong in this algorithm Jacques? More than an year ago all redhat/centos/debian distros used to use MD5
-
Execution Time: Finding a File vs. Finding a Row in MySQL
jazzman1 replied to zekova's topic in PHP Coding Help
The question is how many requests ( approximately per minute) you're expecting to have to DB server? If the DB server is so busy I suggest to use the application server to call those files.- 5 replies
-
- execution time
- time
-
(and 1 more)
Tagged with:
-
Show me how to match the following string using more than one dollar sign in the regexp pattern. Here it's my attempt (using your pattern to create the string) <?php $pattern = '~^\$conn = mysql_connect\("([a-zA-Z._0-9\-]+)", "([a-zA-Z_0-9]+)", "([a-zA-Z_0-9]+)"\);\$mysql_select_db\("([a-zA-Z_0-9]+)", \$conn\);$~'; $string = '$conn = mysql_connect("localhost", "jazzman", "password");'; $string .= '$mysql_select_db("db_name", $conn);'; $arr = array(); if (preg_match_all($pattern, $string, $arr, PREG_PATTERN_ORDER)) { echo '<pre>' . print_r($arr, true) . '</pre>'; } else { echo "a match was not found"; } Result:
-
file_exists() not finding file that DOES exist
jazzman1 replied to stevieontario's topic in PHP Coding Help
To solve this issue try what @trq suggested ( somehow I skipped this comment) and set permissions to ubuntu home directory to be "chmod 755 /home/ubuntu/ -R" or much better to "chmod 750 /home/ubuntu/ -R", then add apache user to be a part of ubuntu user's group. EDIT: His suggestion was to set these permissions to the sub directory, mine is to set these permissions to main user directory, otherwise the webserver won't be able to access files inside. -
file_exists() not finding file that DOES exist
jazzman1 replied to stevieontario's topic in PHP Coding Help
Yep, that was I'm thinking sorry /home/ubuntu/public_html/myfolder -
file_exists() not finding file that DOES exist
jazzman1 replied to stevieontario's topic in PHP Coding Help
Go to the /home/ubuntu/myfolder directory and create an index.html and try again. Don't forget to use a tilde (~) sigh in front of your webmaster name -
In some text editors the carret and dollar sign also match at the start and end of each new line. I'm still thinking that your problem is inside the regRxp pattern.
-
file_exists() not finding file that DOES exist
jazzman1 replied to stevieontario's topic in PHP Coding Help
Don't touch/edit anything if you don't know exactly what you are doing. Are you able to make a request by the browser to that user specific directory/file. Something like - localhost/~ubuntu/myfolder/file -
The dollar sign (without escaping it) means the end of regExp pattern you want to match. Leave only one dollar sign in the end and try again.
-
file_exists() not finding file that DOES exist
jazzman1 replied to stevieontario's topic in PHP Coding Help
Sounds like UserDir mapping directive in apache is not enabled on the second machine.To enabe UserDir open up the apache conf file and change UserDir disable to UserDir public_html and restart the http server, then all requests from the browser to the http server and all php searching functions should be work. The URL request from the browser would be something like - http://example.com/~username/myfolder/test.xml -
you can make this simple test to see what I'm talking about, <form name="f1" action="display.php" method="post"> <input type="text" name="test_input" value="some input text" /> <input type="submit" name="test_submit" value="query" /> <button type="submit">Click Me!</button> </form> Result:
- 10 replies
-
Because js submit() method works like <button type="submit"> Click Me</button>, so the button element isn't as input elements, when the form is being submitted it's omitted from the form. Just create an input hidden element and check its value in the server side.
- 10 replies
-
The submit method submits the specified form as if a submit element (button) was pressed. But the problem is that you also have in the form a submit object element whose property name is using the same name (submit). So, when you set a property name to submit (it doesn't matter which type of the form), you override the submit() function on the form. @To the 2nd question, most likely you need to change if(isset($_POST['submit'])) to if(isset($_POST['send'])), where $_POST('send') is the name of the submit button.
- 10 replies
-
Yes. Make sure you're using a correct path to the file. You'd post your updated script to check what happens at this moment. Use [ code ] tags when providing code.
-
When you go to the doctor or to a hospital, is it important you understand what they say to you?
-
You should tell me, I'm not a magic What I want from you is just to provide us all errors coming from your script, then we'll be able to help you effectively.
-
at a starting point turn on error reporting functions.
-
Then, you need to fix first the server side scripting before to proceed to javascript/ajax.
-
Are you able to upload the image without using ajax?
-
Have you checked what your debugger says?
- 2 replies
-
- jquery
- javascript
-
(and 1 more)
Tagged with:
-
Change name="submit" to something else, for instance - <input type="submit" name="send" />
- 10 replies