php_begins
-
Posts
259 -
Joined
-
Last visited
Posts posted by php_begins
-
-
the userids is stored in a variable called $userid.
forumids are stored in $forumid.
Now i want to print all usernames by querying the post and thread table . I do not want to print the usernames in a while loop.it might take a lot of time.
-
I have the following query where $userid is about 100,000 userids separated by commas.
<? $getpostid=mysql_query("SELECT DISTINCT post.username,post.threadid,thread.threadid,thread.forumid from post,thread WHERE post.username='$username' AND post.threadid=thread.threadid AND post.userid IN ($userid) AND thread.forumid IN ($forumids)") or die (mysql_error()); ?>
can i just print all the usernames from above result separated by ';' without looping it multiple times?
Could someone help me out how to do above in an efficient manner?
-
thank u @requinix and @quickoldcar..both the recomendations work great..
-
so far here is what i did..
i dont know how to check if the url contains showpic.php with parse_url yet.
so $purl=http://www.test.com/showpic.php?do=showpic&u=89165&a=34933; parse_str($purl); echo $u."<br>"; echo $a."<br>";
-
i have had a difficult time trying to work this out.I need to do some pattern matching for certain urls and retrieve information from it.
For example,
$url=http://www.test.com/showpic.php?do=showpic&u=89165&a=34933
if $url contains the value showpic.php,then i need to retrieve the following
{
$u=value of u(i.e. 89165 in this case)
$a=value of a(i.e. 34933 in this case)
}
else do nothin..
the format of the url will always be the same as above if it contains showpic.php
-
i feel stupid now..all i need to do was this..
$url=str_replace("http://cdn.","http://",$url);
-
I tried something like this but didnt seem to wrk.
$url=preg_replace( 'http://cdn.','http://',$url);
-
thanks..wat if i want to replace the cdns only at the start of the url?
-
I retrieve urls that have the following path
$url=http://cdn.test1.com
$url=http://cdn.test2.com and so on...
i want to to do a string replace such that it displays http://test.com,http://test2.com and son without the cdn part.
Will the following work for all cases?
$url=str_replace("cdn.","",$url);
-
thanks a lot...another useful solution i found was this:
$str = 'http://www.test.com/forums/attachment/f39/6066d1267084199-official-ar-m16-m4-picture-thread-dsc00005.jpg'; $filename = pathinfo($str, PATHINFO_FILENAME); $part = substr($filename, 0, strpos($filename, 'd') - strlen($filename)); print $part;
-
Thanks but the thing is f39 is not constant..it may vary for different websites..i need to extract the number after the last slash / Can this be done?
-
Hi i need help with some string manipulation and extraction..
I need to extract an id from the above path dynamically.
I need to extract the digits before the alphabet d after the second last path f39/
In the above case the number extracted would be 745.
Can someone please help me out with it?
-
i didnt explain it properly.
When people click on member_test.php?pn=2 (the link would point to /test/2 in my php code)
it would take them to member_test.php?pn=2, but in the URL it would show /test/2.
So for them it would look like they are in test/2, but in reality it would show the page produced by member_test.php?pn=2
-
I have pagination code in members page that has pages 1,2,3 and so on.
/member_test.php?pn=1 where pn can be 1,2,3 etc.
I need to redirect the above page such that it redirects to /test/1 , test/2 and so on..
I have the following rule which works perfectly fine in the browser.
RewriteRule ^/member_test.php?pn=(.*) /test/$1 [PT]
But the content of the above redirect is always page 1. i.e it always dispays the content of member_test.php?pn=1..
/test/1 ,test/2, test/3 always displays the content of 1.
Can you help me with the current redirect rule..
-
Are there any other member_*.php files you'll want to "redirect"?
No just redirect member_test.php.(Just show the redirect in the browser without actually redirecting that page)
-
i forgot to mention i actually dont want to redirect. It should just show /members/test in the url.
-
I need help with .htaccess redirects.
I need to redirect /members/member_test.php to members/test
(Note: there is no test directory)
-
eh..i already did that.. what i meant was since forms cannot be nested,is there a way around to have the input form upload inside the main form?
-
but i need the upload feature inside the main form..is there no alternate way to do it?
-
I have a problem with nested forms.. when i click the submit button at the bottom of the page i want it to take to display.php and when i click the upload button on the upload form code i do not want to refresh it.
But right now when i click on upload button it takes me to display.php.
Can someone help me out with the code?
<? include("db.php"); include("upload.php"); error_reporting(E_ALL ^ E_WARNING); ini_set("display_errors", 1); <script type="text/javascript"> function initUpload() { /*set the target of the form to the iframe and display the status message on form submit. */ document.getElementById('uploadform').onsubmit=function() { document.getElementById('uploadform').target = 'target_iframe'; document.getElementById('status').style.display="block"; } } //This function will be called when the upload completes. function uploadComplete(status){ //set the status message to that returned by the server document.getElementById('status').innerHTML=status; } window.onload=initUpload; </script> <style type="text/css"> .color { font-weight:bold; color:black; } </style> <div class="color"> <body bgcolor="white"> <center><h4><font color="blue">CREATE NEWSLETTER</font></h4></center> <table align="center" bgcolor="silver"> <form action="display.php" method ="post"> <tr> <td>Site: </td> <td> <select name="new_id"> <option value="">=============</option> <?php foreach($acronym as $key=>$value){ ?> <option value="<?php echo $value['site_id']; ?>"><?php echo $value['acronym']; ?></option> <?php }?> </select> </td> </tr> <tr> <td> Title: </td> <td><input type="text" size ="40" name="newsletter_title" /></td> </tr><tr> <td>Greeting:</td> <td><textarea rows="10" cols="80" name="greeting" ></textarea></td> </tr> <td> URL Title: </td> <td><input type="text" size ="40" name="url_title" /></td> </tr> <tr> <td> URL: </td> <td><input type="text" size ="40" name="newsletter_url" />Begin url with http://</td> </tr> <tr> <td align="center"> <b><font color="#214754" size="3">Banners</b></font> </td> </tr> <tr> <td>Banner Image URL: </td> <td><input type="text" size ="40" name="banner_url1" /> Banner Link: <input type="text" size ="40" name="banner_link_url1" /> </td> </tr> <tr> <td>Banner Image URL: </td> <td><input type="text" size ="40" name="banner_url2" /> Banner Link: <input type="text" size ="40" name="banner_link_url2" /> </td> </tr> <tr> <td>Banner URL: </td> <td><input type="text" size ="40" name="banner_url3" /> Banner Link: <input type="text" size ="40" name="banner_link_url3" /> </td> </tr> <tr> <td>Banner URL: </td> <td><input type="text" size ="40" name="banner_url4" /> Banner Link: <input type="text" size ="40" name="banner_link_url4" /> </td> </tr> <tr> <td align="center"> <b><font color="#214754" size="3">Threads</b></font> </td> </tr> <select name="category1"> <option value="">==========</option> <option value="registry">Registry</option> <option value="reviews">Reviews</option> <option value="classifieds">Classifieds</option> </select> </td> </tr> <tr> <td> Title: </td> <td><input type="text" size ="40" name="registry_title1" /></td> </tr> <tr> <td> Image: </td> <td><input type="text" size ="40" name="registry_img1" /></td> </tr> <tr> <td> URL: </td> <td><input type="text" size ="40" name="registry_url1" />Begin url with http://</td> </tr> <tr> <td height='12'></td> </tr> <tr> <td> Title: </td> <td><input type="text" size ="40" name="registry_title2" /></td> </tr> <tr> <td> Image: </td> <td><input type="text" size ="40" name="registry_img2" /></td> </tr> <td> <form id="uploadform" method="post" enctype="multipart/form-data" action="upload.php"> <input name="file" id="file" size="27" type="file" /><br /> <input type="submit" name="action" value="Upload" /> <span id="status" style="display:none">uploading...</span> <iframe id="target_iframe" name="target_iframe" src="" style="width:0;height:0;border:0px"></iframe> </form> </td> <tr> <td> URL: </td> <td><input type="text" size ="40" name="registry_url2" /></td> </tr> <tr> <td> <input type="submit" name="submit" value="submit" /> </td> </tr> </form> </table> </div>
-
And there might be other utf characters too..
-
-
Hello,
My database has a title field and some of them contain characters that are not recognized by my keyboard.
For example,
Crème brûlée
When I retrieve and print it out it prints fine.But when i try to send them through an email using php email it does not send it.
How can i replace thos invalid characters before sending it through email?
-
do i have to reconvert them to something before displaying?
executing the query once
in PHP Coding Help
Posted
I need to see if the user has posted at least 1 post in one of these forums; 12, 9, 96, 176
and last activity is more then six months ago, meaning they have not logged in within the last 6 months. and then print those usernames
Given current table structure of post,thread,user and forum. This is the only way i could think of so far.Here is my complete code: