![](https://forums.phpfreaks.com/uploads/set_resources_1/84c1e40ea0e759e3f1505eb1788ddf3c_pattern.png)
Canman2005
-
Posts
669 -
Joined
-
Last visited
Never
Posts posted by Canman2005
-
-
Hi
that still produces 01 Jan 1970
thanks
-
Hi all
I have a problem, if I use
print date("d M Y" ,strtotime('03/16/2007'));
then it prints
2007 03 16
which is great.
I have a form though, which posts a field called "expiry" with a date in the same format as above (ie: 03/16/2007), but I cant get the above to work with a posted date, for example. I have tried
$date = $_POST['expiry']; print date("d M Y" ,strtotime("'".$date."'"));
But it always prints 01 Jan 1970
Can anyone help?
Thanks in advance
Ed
-
oooppps
Thanks
-
Hi
My code looks like
if ($rows[type] == 'application/pdf' || $rows[type] == 'text/plain') { print '<p style=margin-top:5px><strong><a href=file_uploads/'.$rows[filename].' target=_blank>View \ Download File</a></strong></p>'; }
So if a filename has a space in it, then it ignore everything after the space
Does that help?
-
Hi all
I have a simple sql statement that pulls a list of files from a sql table, I then print the name of each filename using
print $rows[filename];
This works fine, unless a filename has a spae in it and then it reads everything up to the space.
For example, a filename which prints ok looks like
image1.jpg
but if there is a space for example
image 1.jpg
then it prints
image
and forgets everything after the space.
Is there a fix for this?
Thanks
Dave
-
Hi all
I have a insert script which after it has run, prints the last insered ID, using
printf("%d\n", mysql_insert_id());
Is there a way to set this number as a variable? I know that
$lastidnumber = printf("%d\n", mysql_insert_id());
Doesnt work, so is there a way to do this?
Also, is this the best way to return the last inserted ID? I am using it as a order id number for a small shopping cart.
Any help would be great
Thanks
Dave
-
thanks
-
Hi all
I have a question about if statements, been trying to figure out what the solution could be, but im totally stuck.
Okay, I have a simple if statement
<?php if (isset($_GET['user']) != '') { print "yes"; }
From the above, you will see that if the url is
www.domain.com/page.php?user=dave
Then it prints "yes", but if the url is
www.domain.com/page.php?user=
Then it prints nothing.
This is fine so far, but if user doesnt exist in the url, for example
www.domain.com/page.php
then it prints "yes".
Surley if ?user doesnt exisit in the URL, then it should print anything.
Does that make sense?
How can you say
if user exists in the url then do the following....
Anyone?
Thanks in advance
Dave
-
Oh right, sorry, thanks.
-
Nope, I use UK dates
-
Hi
That works but produces the wrong date, for example, if you use Orio's code with the date
30/2/2006
then it returns
02/06/2008
03/06/2008
04/06/2008
if you use Barand's example with
$day = 29;
$month = 2;
$year = 2007;
then you get
1/3/2007
2/3/2007
3/3/2007
Strange!
Can anyone help?
Thanks
Dave
-
Hi all
I have a loop code which take a date and loops it a number of times, I define the number of times with $duration, the code i'm using is;
$duration = 3; $times = $duration; $x = 0; while ($x < $times) { print $day.$month.$year; print "<br>"; ++$x; }
The above code produces something like
8/2/2007
8/2/2007
8/2/2007
How can I get it to take the date and for each time is loops, increase the date by 1 day, so the above looks like
8/2/2007
9/2/2007
10/2/2007
Is this possible?
Any help would be ace
Thanks in advance
Dave
-
Great, thanks
-
I have found if you replace
if ($_GET['page'] != '')
with
if (isset($_GET['page']) != '')
then it seems to work, is this the case?
-
I have seen that it might be something to do with register globals. Would this be the case and if so, what do I need to change?
Never had to deal with this register globals issue before
Thanks
-
Hi all
I have a website online which I have taken offline to work on it, but when I load the pages, I get the error
Notice: Undefined index: id in C:\www\web\connect\websitedata.php on line 5
The code for this websitedata.php page is shown below.
<? $formaturl = explode('?',$_SERVER['REQUEST_URI']); $url = $formaturl[0]; if ($_GET['id'] != '') { if ($_GET['page'] != '') { $webinfosql = "SELECT * FROM websitecontent WHERE `id` = '".$_GET['page']."'"; print $webinfosql; } else { $webinfosql = "SELECT * FROM websitecontent WHERE `id` = '".$_GET['id']."'"; print $webinfosql; } } else { $webinfosql = "SELECT * FROM websitecontent WHERE `url` = '$url' AND (`level` = '1' || `level` = '0')"; print $webinfosql; } $webinfoquery = @mysql_query($webinfosql,$connection) or die(mysql_error()); while ($webinforow = mysql_fetch_array($webinfoquery)) { $webinfoid = $webinforow['id']; $webinfotitle = $webinforow['title']; $webinfomastertitle = $webinforow['mastertitle']; $webinfoimage = $webinforow['featureimage']; $webinfoimage1 = $webinforow['image1']; $webinfocontent = $webinforow['content']; $webinfoadobereader = $webinforow['adobereader']; } ?>
Can anyone see why I am getting this error?
Any help would be great
Thanks in advance
Dave
-
no they do support php as we have loads of php pages working on the server
-
Hi all
I have some php pages which do things like managing users, the pages have been fine but for some reason, when I go onto one of the php pages, it tries to force a download of the php page rather than loading it.
Why would it be doing this?
Thanks in advance
Ed
-
Thanks Guys
-
Hi all
I have a value defined like
$url = $_SERVER['HTTP_REFERER'];
print $url;
Which produces a url with a
did number which can be something like 55
and a
tid number which can be something like 3
a full example is
http://www.myweb.com/files/page.php?did=55&tid=3
I want to get php to format whatever is outputted and then remove everything before the did number and everything after it.
With the above, it would remove the first part
http://www.myweb.com/files/page.php?did=
and then the second part
&tid=3
and leave me with just
55
Can this be done? Its hard to explain what I mean but someone may understand me
Thanks in advance
Dave
-
Hi all
I seen a few people have read this but had no solution, should I be writting my message a different way to help people figure a solution out?
Thanks
-
If you need snippets of the tables, let me know
-
Hi all
I'm having a real issue with altering a script I have written and I hope someone can help.
Basically I have taken over some changes on a website done by a past programmer who had no clue about anything and im trying to pick up with pieces, I cant change the way the database is, as it would effect other parts of the site, so I have had to bodge together a solution.
Basically it is a document store, which shows a heading such as
Employment Documents
and then shows the documents related to that heading, under it, like
Employment Documents
Document 1
Document 2
Document 3
It then shows the next heading under, and the follows with those documents, and so on.
I have supplied my query below and explained what im doing for each part (sorry for the long code)
<? $db_name ="****"; $server = "localhost"; $dbusername = "****"; $dbpassword = "****"; $connection = mysql_connect($server, $dbusername, $dbpassword) or die(mysql_error()); $db = mysql_select_db($db_name,$connection)or die(mysql_error()); ?>
This is my db connect
<? $searchsql = "SELECT * FROM page_documents WHERE pd_pgid <> 58 AND pd_pgid <> 70 GROUP BY pd_pgid ORDER BY pd_id ASC"; $searchresult = @mysql_query($searchsql,$connection) or die(mysql_error()); $cols = 2; $showcol = 0; ?>
I then get a list query a database which has lots of rows, each row hold the ID number for the relavant document from the document table and also the ID number of the Document title from the document title table. Basically each time a new document is added, a new row is added, so I have done a GROUP BY so that it groups all the Document Headings together so I dont get duplicates.
<table width="800" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="left" valign="top"> <table width="400" border="0" cellpadding="10" cellspacing="0"> <?php while($row = mysql_fetch_row($searchresult)) { $zero = $row[0]; $one = $row[1]; $two = $row[2]; if ($showcol == $cols) { ?> <tr> <? $showcol = 0; } ?> <td align="left" valign="top"><table width="380" border="0" cellspacing="0" cellpadding="0"> <tr> <td valign="top"><table border="0" cellpadding="0" cellspacing="0" style="background-image:url(images/elements/quickviewbox.gif)"> <tr> <td align="center" valign="top"><table border="0" cellspacing="0" cellpadding="0"> <tr> <td height="14" align="left" valign="bottom" class="bold9black"> <?
That builds part of the table
$sql = "SELECT * FROM pages WHERE pg_id = $two"; $query = @mysql_query($sql,$connection) or die(mysql_error()); while ($row=mysql_fetch_array($query)) { ?> <strong><? print $row['pg_shortname']; ?></strong> <? print "<br>"; }
This takes the document page ID numbers it got from the first query and gets looks in the document title table and get the Docunt Title
$sql = "SELECT * FROM page_documents WHERE pd_pgid = $two"; $query = @mysql_query($sql,$connection) or die(mysql_error()); while ($row=mysql_fetch_array($query)) { $sql1 = "SELECT * FROM documents WHERE dm_id = '".$row['pd_dmid']."'"; $query1 = @mysql_query($sql1,$connection) or die(mysql_error()); while ($row1=mysql_fetch_array($query1)) { ?> <? $type = mime_content_type("upf/".$row1['dm_file'].""); ?> <? if($type == 'application/pdf') { ?><img src="../images/pdf.gif" /><? } elseif($type == 'text/plain') { ?><img src="../images/word.gif" /><? } ?> <a href="upf/<? print "".$row1['dm_file'].""; ?>" target="_blank"><? print "".$row1['dm_name'].""; ?></a><br> <? } } ?>
This part looks in the documents table and gets a list of the documents under that Document Title ID number
</td> </tr> <tr> <td height="1" class="linex"></td> </tr> </table></td> </tr> </table></td> </tr> <tr> <td height="20" style="background-image:url(images/elements/quickviewboxbottom.gif); background-repeat:no-repeat; background-position:left"></td> </tr> </table> </td> <? $showcol++; } $matchcol = $cols - $showcol; for ($i=1; $i<=$matchcol; $i++) { } ?></table></td> </tr> </table>
Finishes off the table build
Does that make sense?
Basically what I want to do is to put a global limit on it, so that I can produce one page with the code above, which shows a maximum of 12 documents globally on the page, sorting by ID number and then another page with the same code above, showing everything after the ID number 12.
Can anyone help? Due to the linking of tables, I cant seem to get my head around it.
Any help would be great
Thanks in advance
Ed
-
Hi
so what background value keeps it transparent?
Thanks
Formatting posted date
in PHP Coding Help
Posted
post