Jump to content

squiggerz

Members
  • Posts

    59
  • Joined

  • Last visited

    Never

Everything posted by squiggerz

  1. Tried dropping the concatenation? like $path = "../images/$Date/blah/blah";
  2. I'm guessing you meant something like http://www.url.com/file.php?page=pagename Right?
  3. Ok, I'm pulling values from a db, the values are all domain names. Is there any way after pulling them in with a while loop, that I can define a variable name as the value of what I have pulled? $query = "SELECT city FROM cities ORDER BY city"; $results = mysql_query($query); while ($row = mysql_fetch_array ($results, MYSQL_ASSOC)) { $thisiswhereIwantTheValueToGo = $row['city']; } I understand that the above will make the value of the variable = to the $row['city'], is there any way I can dynamically create the variable name based on that same value?
  4. Ok, I have a table with about 10 fields right now, about 6 or 7 of those fields are named by domain names (i.e. phpfreaks.com, domain.com, website.com). I'm wanting to be able to query through php to add a new field name to this table that is a domain name but add it in alphabetically with the other fields that are domain names. For instance, say I have ID | Name | Domain.com | Phpfreaks.com | Website.com | as field names already. What if I want to add a new field called Freelance.com, but I want it to be added between Domain.com and Phpfreaks.com (alphabetically, right). Is there any way possible to do this?? I'm guessing I could probably select all fields that end with .com, .net, or whatever with a regex in php, then figure out a way to get it in the list alphabetically, but how would I structure a query of this sort?
  5. You would have to make it part of the form. What are all of your item types you are wanting the user to select through?
  6. The reason those $_POST values are present is because you submitted them from the form on the first page. The php interpreter looks for certain tags (in your case the <input tag) and takes their names and values and makes them a part of the $_POST[] array and automatically sends them to the next page. The reason the $_POST['itemtype'] does not work is because you are trying to declare on the first page that $itemtype = $_POST['itemtype'], but on this first page $_POST['itemtype'] does not have a value yet. Its like you are trying to call on a variable that does not exist because it was never transferred from another page to your first page. Anybody feel free to correct me if I'm off base here.
  7. I may be wrong here, but it looks like on your first page ( on this last post I mean) you are declaring the $itemtype var to contain the value from $_POST['itemtype']. But if you aren't posting this value TO this page from another page, there will not be a value there. Looks like you might have bigger problems though, I think your form scheme is a little sketchy. Vijay had the right idea I think, considering what info you gave initially. Here's what I'm thinking: Take your form: echo '<form action="insert_item.php" method="post">'; echo '<table boder="0">'; echo '<tr>'; echo '<td>UPC</td>'; echo '<td><input type="text" name="UPC" maxlength="13" size="13"> <br /></td>'; echo '</tr>'; echo '<tr>'; echo '<td>Title</td>'; echo '<td><input type="text" name="Title" maxlength="100" size="25"><br /></td>'; echo '</tr>'; echo '<tr>'; echo '<td>Author</td>'; echo '<td><input type="text" name="MajorAttribute" maxlength="100" size="25"><br /></td>'; echo '</tr>'; echo '<tr>'; echo '<td>Publisher</td>'; echo '<td><input type="text" name="SecondaryAttribute" maxlength="100" size="25"><br /></td>'; echo '</tr>'; echo '<tr>'; echo '<td colspan="2"><input type="submit" value="Register"></td>'; echo '</tr>'; echo '</table>'; echo '</form>'; That was your first case of course. On your input type=" blah blah part... the name="whatever" part is what will be posted in the $_POST['whatever'] variable, and whatever variable you are defining from it will be the value of that $_POST['whatever'] var.. Here's a test for you: add these echoes to your second page echo $_POST['UPC']"<br />"; echo $_POST['Title']"<br />"; echo $_POST['MajorAttribute']"<br />"; Now go back and fill your form fields out and submit the form. Hope that points you in the right direction
  8. Kind of.. like a spelling/grammar checker that checks against a text file. Apparently I'm having a harder time explaining this than I'm probably going to have putting a solution together. Say for instance I have a .txt file on a server. This file can have any characters in any situation possible, but for our purposes it will have a paragraph of random sentences. This file however will serve as the dictionary to which the input is checked by. On the same server will reside a web page with a form that just has a text box. Now, consider that you do not know what is in the text file, but I will read it to you. You have to type out what was said to you into the text box, when you submit, the script will check what you typed against the text file looking for differences. They could be spelling errors, too many whitespaces, combining two words, improper punctuation?!.?!?!. So it's like I'm not looking for what matches in the comparison of the two strings in question, I'm looking for what does NOT match. I'm trying something out with quite a few loops and if's and strtok, strpos, etc right now, I'm just hoping somebody out there knows of a simpler way (maybe a function I haven't found yet that might shortcut this a little bit. Did this make any sense?
  9. I'm thinking though, maybe it doesn't need to be a preg_match after all.. strpos apparently takes full strings in variables and matches them against whatever you give it so maybe if I can create some sort of explode/foreach/strpos loop system, it might work better. The idea is to match specifically to the text file and wherever it does not match, put the unmatched area into a variable to display later. It will work as a sort of pseudo-spell checker, where the only dictionary (so to speak) to match against is the text file. The person would submit a input box via a form, how they'll get the text to type here would be a recording. So more or less its like a mild form of dictation, and the text file will grade the person's accuracy and record the errors exactly. I'll try the strpos thing first.. if that doesnt get me anywhere I'll be sure to move this to the regex area to see if somebody there can come up with something. Did this post clear anything up??? I'm starting to feel a little Punjabi here lol
  10. Guess I could have elaborated that better after all Like this: <? $checktext = file_get_contents("sometext.txt"); // the only line in sometext.txt is: Hey, I have a sentence here! Hooray for sentences? No, not really... /* notice slight differences, 3 periods at the end, only two in the var below, missing exclamation point etc.. */ $text = "Hey, I have asentence here. Hoooray for sentences? No, not really.."; //now some pseudo-code: check ($text against $checktext) WHERE $text != $checktext insert into an array ?> Hope that explains a little better of what I'm trying to get at. The more I am thinking about it, the more I am leaning towards having to explode both variables by whitespace, count the whitespaces, and compare arrays, just hoping there's a simpler way around it.
  11. Maybe there's a part of the regular preg_match function that I missed that actually does this, but what I'm trying to accomplish is: Say you have a text file with a sentence or two, here's an example: "Hey, I have a sentence here! Hooray for sentences? No, not really.." Say you input some text into a variable that looks nearly identical to this, but there are small errors, maybe some missing punctuation points. Now I know that preg_match will find matches, but is there any way to find non-matches, so as to throw a flag at the variabled text with preg_match or a similar function? I've been racking my brain for a while and cant seem to find a function that... eh.. matches what I'm looking for. ^o^ Thanks in advance for any help. Sq
  12. say I have a list of categories in a field, and a page that is supposed to pull from the db based on a category. Is there any way I can do a query where it searches the contents of that field for the category in question? like SELECT FROM table WHERE category = $category but have it search the category field (the comma separated list for each entry) for the $category var
  13. I know this was solved but I figured it would be better to 'unsolve' this than start a new thread. // NOT recommended, but if you must have comma-sep list // instead of writing them to a separate table ^^ I now see the flaw of not just starting a new table, but how would you go about something like that? I mean I know how to set up a table, but would I just make a table that has the customers name as a field and then have 100 category fields and have them as flag 1 or 0 fields??
  14. nevermind, you already gave me that tidbit, must have missed it before.
  15. foreach ($_POST['cat'] as $catid) { $catid = "," . $catid; } One last question, will the above give me a comma delimited output for the variables in the foreach loop?
  16. works like a charm! Thanks a million!
  17. So as far as the checkbox names go, I can have as many as I want with the same name and all have different values?
  18. if($_POST) { foreach($_POST as $post -> $id) { echo "POST: ".$post."<br>POSTID: ".$id."<br>"; } Thought this might work... all I get on my echo is POST: Object POSTID: for each of the $_POST variables.. any ideas?
  19. Have you tried using a query like mysql_query("SELECT Activity_name FROM db_table_name WHERE month = $thismonth"); and have $thismonth = date('m'); or $thismonth = date('F'); http://www.php.net/manual/en/function.date.php for reference. Hope I understood what you meant and that helps some.
  20. I've read the 40 dozen posts on here dealing with checkboxes, either the replies dont apply to my situation or I'm just not grasping this concept yet (the latter probably). <? if ($_GET['add']) { $i = 0; $w = 0; echo '<table class="style3" align="right" width="90%" border="0" cellspacing="1"><tr>'; while ($a_row = mysql_fetch_array ($a_results, MYSQL_ASSOC)) { $i++; $w++; echo '<td valign="middle" align="left" width="25%">'; echo "<label><input type=\"checkbox\" name=\"".$a_row['category']."\" id=\"".$a_row['category']."\" value=\"".$a_row['category']."\""; if($a_row['category'] == $ucat) { echo " checked >"; } else { echo ">"; } echo $a_row['category']."</label>"; if($i % 1 == 0) { echo '</td> <td valign="middle" align="left" width="25%" valign="top">'; } if($w % 4 == 0) { echo '</tr> <tr>'; } } echo '</td></tr></table>'; } ?> Ok, this loop goes through an array of categories from a categories table in my db, the table has 2 fields, id & category, id is autoincremented. It works correctly, naming the checkbox & giving it the value of the variable from the array like its supposed to. When my form is submitted, how am I supposed to update my users table, which has a field 'category' that I want to have updated with all of the categories, I guess comma delimited. Should I just make another loop like if ($somevar) { while($_POST['WHATDOIPUTHERE?'] == $category) { //build my update query based on the $_POST[whatevergoeshere] var? } } I guess my real question would be, how do I loop the $_POST array to check against the categories table? I think... hope that made some sense to somebody. SQ
  21. Definitely the formatting, I can grab from the db based on the alpha letter, but right now I've just got a while loop echo'ing the output: if ($a_results) { while ($a_row = mysql_fetch_array ($a_results, MYSQL_ASSOC)) { echo $a_row['biz_name']."<br>"; } } So I can return the data, I just want to be able to display it like they have it, in those nice 10 item columns. Just cant wrap my head around how to display it correctly..
  22. It's late, I've tried about 100 queries through google and several here.. possibly I'm not searching for the right words? Anyway, here's an example of what I'm trying to achieve and have no idea where to start: http://www.viroqua-wisconsin.com/directory/default.asp?alpha=A On that page, the listings, they are pulled from the db obviously by the first letter of their name. Check. I can do this. How do you format the results like that? Like 10 in a column, then 10 more in another column, I guess if there are more than 30 on that page, a paging file will likely start a page numbering list of some sort. Anybody know how to get them in those 1x10 columns and is nice enough to share the wealth of knowledge?? SQ
  23. Ok, what I'm trying to do is take a page as a query string in a script (ie. http://www.mysite.com/getheaders.php?url=http://www.vid2c.com/show_video.php?video_id=0a82ec5e1e25d1c6df87439b60fe8847&rand=924708232484.5725/) I'm trying to get all the actual files's urls, like on that page I am trying to get the actual urls for the js file, php, 2 swf files, the flv file etc, which I know will have to be in a loop somehow with a regular expression match to find all the links to these files in the code from the original vid2c.com/... url. Is it possible to return the location of these files through the headers using curl? I use LIVE HTTP Headers extension for Firefox, so I know it is possible to get the actual urls for all the files, is it possible to do this through PHP or am I completely off base? Thanks in advance for any insight. SQ
  24. Ok, according to my phpinfo, I have a php install with the --enable-zip configuration. Yet when I try to run this: if (zip_open($filename) === TRUE) ... or any other function under the ZipArchive class (even if I start a new ZipArchive).. I get this error: PHP Fatal error: Call to undefined function zip_open() ... so... am I needing to include a file in a lib somewhere in my php file or something? I figured if ZipArchive was configured by php, it should include all the global functions associated right?? Here's the excerpt from php info that shows the --enable-zip if that is any help './configure' '--host=i686-pc-linux-gnu' '--build=i686-pc-linux-gnu' '--target=i386-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/usr/com' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--cache-file=../config.cache' '--with-config-file-path=/etc' '--with-config-file-scan-dir=/etc/php.d' '--enable-force-cgi-redirect' '--disable-debug' '--enable-pic' '--disable-rpath' '--enable-inline-optimization' '--with-bz2' '--with-db4=/usr' '--with-curl' '--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr' '--with-png-dir=/usr' '--enable-gd-native-ttf' '--without-gdbm' '--with-gettext' '--with-ncurses' '--with-iconv' '--with-jpeg-dir=/usr' '--with-openssl' '--with-png' '--with-regex=system' '--with-expat-dir=/usr' '--with-dom=shared,/usr' '--with-dom-xslt=/usr' '--with-dom-exslt=/usr' '--with-zlib' '--with-layout=GNU' '--enable-bcmath' '--enable-exif' '--enable-ftp' '--enable-magic-quotes' '--enable-safe-mode' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-discard-path' '--enable-track-vars' '--enable-trans-sid' '--enable-yp' '--with-kerberos' '--with-ldap=shared' '--with-mysql' '--enable-memory-limit' '--enable-bcmath' '--enable-shmop' '--enable-calendar' '--enable-dbx' '--enable-dio' '--enable-mcal' '--enable-mbstring=shared' '--enable-mbstr-enc-trans' '--enable-mbregex' '--enable-force-cgi-redirect' '--enable-zip' '--with-apxs2=/usr/sbin/apxs'
  25. Thank you so much! I had to rearrange it a bit for it to work with what I had, but it did work, now I can sleep! Thanks again! if($sleep) { $i = 0; foreach($doms as $key => $value) { $domain = trim($value); require 'single.php'; $i++; if($i == '400') { echo "400 domains - resting 10 minutes"; sleep(600); $i = '0'; } } }
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.