-
Posts
3,404 -
Joined
-
Last visited
-
Days Won
55
Everything posted by Ch0cu3r
-
Will not echo the new user welcome paragraph
Ch0cu3r replied to Shadow_Walker's topic in PHP Coding Help
That code is fine except for the opening PHP tag <? The code will only run if your have a setting called short_open_tag enabled in the php.ini. Otherwise you will need to use the full opening tag <?php I would recommend you to always use the full opening PHP tag, as not all configurations of PHP has short tags enabled. -
Are you sure the checkboxes are included in your form? Also you have a malformed printf statement, what is the ,"] just before the closing parenthesise for?
-
No DOCUMENT_ROOT refers to the root folder that the webserver serves files from (in your case localhost). By default WAMP will (or rather Apache is configured to) serve files from C:/wamp/www If you want to change this you'll need to alter Apaches configuration. Or setup a virtual host for your project so document root refers to your projects root folder.
-
Image browse & upload not displaying using php
Ch0cu3r replied to Vinodpv's topic in PHP Coding Help
Does your company table have an id field? That will be the field you'd reference the row in the WHERE clause for the UPDATE/SELECT query, eg example for select <?php $company_id = intval(.. company id val..); // get the row that matches the company id $result=mysql_query("select * from company where id=$company_id"); if(mysql_num_rows($result) > 0) { { $row=mysql_fetch_assoc($result); // output image path in the src attribute echo '<img src="'.$row['photo'].'" />'; } ?> -
Use Trim
-
So your instructor has given you code which has errors, which is intentional, and it is your task to track down those errors and correct them. The first step you need to do then is to enable error reporting as requinix suggested in his earlier post. If you do have access to the php.ini then you can still enable error reporting by adding these two lines at the top of the script (after the opening <?php tag) ini_set('display_errors', 1); error_reporting(E_ALL); With error reporting enabled PHP will display error messages. By reading the error message you should be able to solve the errors on your own.
-
Umm... look at line 45 of sendMail.php
-
You mean to say you have those variables and they are numbered 1 through to 24? eg $UserID1, $UserID2 ... $UserID24 etc If thats the case you should not doing that, you should be using arrays. Naming variables like that is bad practice. Can you tells use how those variables are defined? We can help you to convert those variables to an array if you are unsure An insert query can insert more than one record at a time. example structure of a multi-insert query INSERT INTO table_name (... cols ...) VALUES (... value set 1...), ( ... value set 2...), //etc.. As you see each set of values for each row are wrapped in parenthesise. And, Yes you'd use a loop to build query.
-
Image browse & upload not displaying using php
Ch0cu3r replied to Vinodpv's topic in PHP Coding Help
Don't store the images in the database, this makes things more complex later. You are best of saving the uploaded image to the filesystem, look at using move_uploaded_file to do this. And then only save the image path in the database. eg $image_dir = 'images/'; // where images are to be stored $image_name=mysql_real_escape_string($_FILES["image"]["name"]); $image_path = $image_dir . $image_name; // image path, this path is saved in the database // move the uploaded file, to the image dir if(move_uploaded_file($_FILES["image"]["tmp_name"], $image_path)) { $insert=mysql_query("insert into images values('','$image_name','$image_path')"); if(!$insert) echo 'Database error: ' . mysql_error()); } else { echo 'Unable to move '.$_FILES["image"]["name"].' to '.$image_dir; } Now to display the image you can echo the image path into the src attribute for the <img> tag, eg <?php $result=mysql_query("select * from images"); while($row=mysql_fetch_array($result)) { echo '<img src="'.$row['image'].'" />'; } ?> Also dont use addslashes to sanitize user input use mysql_real_escape_string or better yet convert your code to mysqli or PDO and use prepared queries -
Are you sure that is correct? What is the original date/time? $time1 Your are converting the original date/time to a timestamp ($time1i = strtotime($time1)) and then using date() to format it into a hard to read date format of YYYYMMDDHHMMSS. Also are you sure you're using the same timezone as the original date/time? This could have an affect on the outcome of the date.
-
Its a carousel. Try goggling - javascript carousel for examples/scripts
- 1 reply
-
- wordpress
- categories
-
(and 1 more)
Tagged with:
-
NO, you replace the code in your first post with my code.
-
How to change one of the results to a string
Ch0cu3r replied to SamNewbie's topic in PHP Coding Help
You never said that before, so the cities are listed in a $citenames array and the same applies for gender? In that case you need to first include lists.php include 'lists.php'; and the use $row['user_city'] as the array index for the $citynames array, eg echo "City: ", $citynames[ $row['user_city'] ]; If the genders is also listed in lists.php then you'll do a similar thing for gender echo "Gender: ". $gender_array_var[ $row['user_gender'] ]; Change $gender_array to the name of the variable that holds the array of genders -
How to change one of the results to a string
Ch0cu3r replied to SamNewbie's topic in PHP Coding Help
Yes, you'll need to use JOINS in your query to fetch the data from the other tables, example Can you post a the schema for the gender and city tables? That is good practice, it called data normalisation. -
$username in the update query should be wrapped in quotes $updatepass = "UPDATE members SET password='$db_password' WHERE username='$username'"; If the password is still not updating you'll want to check to see to see if mysql_query is failing due to an error, then use mysql_error to find out what the error is.
-
How to change one of the results to a string
Ch0cu3r replied to SamNewbie's topic in PHP Coding Help
Your mean $row['user_city'] returns 1 and not London? The user_city field in the users table may be used as a foreign key to retrieve the actual city name from another table in your database? -
Where is $username defined?
-
The problem is here if($pCntHalf < $iUp){ $div = 2; $div = 1; }else{ $div = 0; } $div = 1 is overriding $div = 2. In what order are you wanting to display the content? left to right?, eg 1 2 3 4 5 6 or down and left? 1 3 5 2 4 6
-
You wouldn't need to a loop at all, use preg_replace_callback and write a function to do the conversion $insert = preg_replace_callback("/([\d]+)\/([\d]+)/m", function($m) { list(, $num1, $num2) = $m; if($num1 == 0 || $num2 == 0) $dec = 'division by zero'; else $dec = $num1 / $num2; return $dec; } , $insert);
-
DIV Tags - Help Needed (3 column design)
Ch0cu3r replied to anilsingh1605's topic in Javascript Help
I will put hand up here and say I am out of my depth here. My JQuery knowledge is limited at best. However what you are doing is totally possible, but Im not the right person to direct you. Maybe someone else here will have a better insight into this. But what I do know is you are creating a Single Page Application. Which there are frameworks specifically designed to help you with this. You may want to check out AngularJS or similar. -
No, no you can have a list within a table, along as it is in a table cell (<td></td>). <table> <tr> <td> text <ul> <li>item 1</li> <li>item 2</li> </ul> </td> </tr> .... </table> The way how you are describing your problem is you're wanting the list to do something like this <ul> <table> <tr> <td> text <li>item 1</li></td> </tr> <tr> <td> another <li>item 2</li></td> </tr> </table> </ul> Which you cant do.
-
You'll need to post more code, such as how are you checking to see if the user is logged in or not. It could be you have logic issue and the logout code is being ran somehow, or you're starting the session after output has been sent to the browser, which you cannot do. So you might want to post examples of how you are starting the session.
-
You have not answered my question in my previous post. It is not possible to have a <ul> list that spans multiple table cells and rows at the same time.
-
So login form is no longer working?