AyKay47
Members-
Posts
3,281 -
Joined
-
Last visited
-
Days Won
1
Everything posted by AyKay47
-
image upload to server, writing image name to mysql
AyKay47 replied to ggw's topic in PHP Coding Help
if you have error_reporting set to -1 and display_errors on, you should be receiving an error upon upload failure, and any other errors for that matter. -
w3schools simply leads new programmers down the wrong path. Since they do not know any better, they think the site is awesome. It's not.
-
image upload to server, writing image name to mysql
AyKay47 replied to ggw's topic in PHP Coding Help
please post the updated code, along with any errors you are receiving. -
how to check entries exist in mysql database or not?
AyKay47 replied to vinod_vsd's topic in MySQL Help
I will post the code that was pm'ed to me for other to see: <?php include("top.php");?> <?php $where=""; if(isset($_POST['courier_no'])) { $var=$_POST['courier_no']; $where=" AND A.courier_no LIKE '". $_POST['courier_no'] ."%'"; } ?> <tr> <td class="content" valign="top"> <table width="100%" border="0" align="right"> <tr bordercolordark="#FF0000"> <td align="center" colspan="2"> <h2 align="center"><font color="#FF0033" size="5" face="Courier New">Your Courier Details</font></h2> </td> </tr> <table width="99%" align="right" style="border:solid 1px" class="nav_sel"> <?php include("connect.php"); ?> <?php $courier_id=0; $sql=("SELECT A.courier_id, A.courier_no , A.sender_name ,A.saddress, B.location_name AS Sender_location , A.reciever_name ,A.raddress , C.location_name AS Reciever_location FROM courier_detail A,location B,location C WHERE A.location2 = B.location_id AND A.location_id = C.location_id AND A.isdelete=0 ".$where) ; $result =mysql_query($sql); while($row = mysql_fetch_array($result)) { $courier_id=$row['courier_id']; echo "<tr>"; echo"<td height='31' colspan='1' align='center'><b>Courier No :</b></td>"; echo"<td width='117' colspan='0' bgcolor='#dce4ff'>". $row['courier_no'] ."</td>"; echo "<td width='117' height='29'></td>"; echo "<td colspan='0' height='30' bgcolor='#dce4ff'></td>"; echo "</tr>"; echo "<tr>"; echo "<td width='100' height='34'><b> Sender Name :</b></td>"; echo "<td width='117' bgcolor='#dce4ff'>". $row['sender_name'] ."</td>"; echo "<td width='110'> <b>Reciever Name :</b></td>"; echo "<td width='117' bgcolor='#dce4ff'>". $row['reciever_name'] ."</td>"; echo "</tr>"; echo "<tr>"; echo "<td height='29'><b>Sender Address :</b></td>"; echo "<td bgcolor='#dce4ff'>". $row['saddress'] ."</td>"; echo "<td><b>Reciever Address :</b></td>"; echo "<td bgcolor='#dce4ff'>". $row['raddress'] ."</td>"; echo "</tr>"; echo "<tr>"; echo "<td height='29' width='135'><b>Sender Location :</b></td>"; echo "<td width='70' bgcolor='#dce4ff'>". $row['Reciever_location'] ."</td>"; echo "<td width='135'><b>Reciever Location :</b></td>"; echo "<td bgcolor='#dce4ff'>". $row['Sender_location'] ."</td>"; echo "</tr>"; ?> <?php echo "</td >" ; echo "</tr>"; } echo "</table>";?><br /> <h2 align="center"><font color="#FF0000" size="5" face="Courier New">Courier Tracking Details</font></h2> <table width="99%" border="0"align="right" style="border:solid 1px" class="nav_sel"> <?php $sql ="SELECT A.remark, A.recieve_date, A.transit_id, B.location_name AS Forward_To, D.type_name AS Courier_Type,E.courier_no AS Courier_No, C.status_name AS Status FROM transit A, location B,STATUS C,TYPE D,courier_detail E WHERE A.location_id = B.location_id AND A.status_id = C.status_id AND A.type_id = D.type_id AND A.courier_id=E.courier_id AND E.courier_id=".$courier_id." order by recieve_date asc"; $result1 =mysql_query($sql); while($row1 = mysql_fetch_array($result1)) { echo "<tr>"; echo "<td width='110' height='29'><b>Status :</b></td>"; echo "<td width='117' bgcolor='#dce4ff'>". $row1['Status'] ."</td>"; echo "<td width='117' height='29'><b>Recieve Date :</b></td>"; echo "<td width='117' bgcolor='#dce4ff'>". $row1['recieve_date'] ."</td>"; echo "</tr>"; echo "<tr>"; echo "<td width='117' height='29'><b>Forward Towards :</b></td>"; echo "<td width='70' bgcolor='#dce4ff'>" . $row1['Forward_To'] ."</td>"; echo "<td width='117' height='29'><b>Courier Type :</b></td>"; echo "<td bgcolor='#dce4ff'>". $row1['Courier_Type'] ."</td>"; echo "</tr>"; echo "<tr>"; echo "<td width='117' height='29'><b>Remark :</b></td>"; echo "<td colspan='0' height='30' bgcolor='#dce4ff'>". $row1['remark'] ."</td>"; echo "<td width='117' height='29'></td>"; echo "<td colspan='0' height='30' bgcolor='#dce4ff'></td>"; echo "</tr>"; ?> <?php echo "</td >" ; echo "</tr>"; } echo "</table>";?> <?php mysql_close($con); } ?> </td> <?php include("footer.php"); ?> ///////// the whole file is my courier_list.php add some debugging to your script to see what is happening: $sql = "SELECT A.courier_id, A.courier_no , A.sender_name ,A.saddress, B.location_name AS Sender_location , A.reciever_name ,A.raddress , C.location_name AS Reciever_location FROM courier_detail A,location B,location C WHERE A.location2 = B.location_id AND A.location_id = C.location_id AND A.isdelete=0 ".$where; $result = mysql_query($sql) or die($sql . '<br />' . mysql_error()); 1. the parenthesis should be removed from the actual SQL. 2. run that snippet and post the results. -
image upload to server, writing image name to mysql
AyKay47 replied to ggw's topic in PHP Coding Help
there are examples on the page that you were linked to. In the given script, you are simply setting $uploadedfile to name of the file in the tmp directory. This has nothing to do with actually uploading the file to your server. -
how to check entries exist in mysql database or not?
AyKay47 replied to vinod_vsd's topic in MySQL Help
you still have not explained your logic. -
What would be the point of having users actually create a form? Why not have a form already there, and allow users to edit the form (add input fields etc.)?
-
how to check entries exist in mysql database or not?
AyKay47 replied to vinod_vsd's topic in MySQL Help
can you please post all of the relevant code, I don't quite understand what your issue is. -
elseif($field == "oil_waste_ltr") { if(!preg_match("~^[0-9]{1,10}\.[0-9]{2}$~",$value) ) { $bad_format[] = $field; } }
-
Is the .css file mapped correctly?
-
never use the @ error suppressing operator ever really. IMO, it's simply a band-aid for improper error handling.
-
what are the permissions of the directory that you are moving the file to?
-
remove non-alphanumeric characters except underscore
AyKay47 replied to Nodral's topic in Regex Help
There are several ways, I would first use iconv to remove undesired encoded characters: $value = iconv("UTF-8", "ISO-8859-1//IGNORE", $value); $value = preg_replace('~\W*~', '', $value); echo $value; -
remove non-alphanumeric characters except underscore
AyKay47 replied to Nodral's topic in Regex Help
Can you give me an example? Also note that I forgot the delimiters in my above reply. -
remove non-alphanumeric characters except underscore
AyKay47 replied to Nodral's topic in Regex Help
Use preg_replace, erg_replace is deprecated. \w includes alpha-numerical characters and an underscore. $value = preg_replace('\W*', '', $value); -
mysql error: for the right syntax to use near ')
AyKay47 replied to newphpcoder's topic in MySQL Help
So use SUM()..? -
The user above me is correct, this can be done by either storing the dynamic parts of the query in a session, or by adding them to the query-string. So you would have something that looks like: http://site.com/some_folder/file.php?like=protein&start=25&limit=25 the above would be the link to the second page, which you can use to re-build the query. Note: the best way would be to use a prepared statement, but that is a different story.
-
I cant believe I missed that, thank you and sorry for wasting your time. Not a problem, glad it's sorted.
-
What are the specific requirements of the update? Perhaps something like this: UPDATE `records` SET `status` = 'a' WHERE `date` = '2011-12-02' AND `employe_id` IN ( ... ) The IN clause would contain a comma delimited list of ids
-
user ids are typically stored inside of a session for use throughout the entire website.
-
this is not needed, variables are interpolated inside of double quotes, what the OP has is fine. why? back-ticks are perfectly valid and are typically encouraged to wrap identifiers. OP, debug the query a little to see what is going wrong: $sql = "SELECT * FROM news WHERE `ref` = '$last'"; $query = mysql_query($sql); if(!$query) { echo $sql . "<br />" . mysql_error(); }
-
and what results does this query give you
-
Checked dynamic checkboxes for update and query
AyKay47 replied to femiot's topic in PHP Coding Help
By using the checked attribute. Can we see the code please? -
well, what are the actual results?
-
Re-read my first reply, the date() function requires a TIMESTAMP as the second argument. You need to convert the datetime field into a TIMESTAMP using unix_timestamp()