Jump to content

aramikgh

Members
  • Posts

    16
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

aramikgh's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Would it be possible to do a ... $result = preg_replace_callback('/(?<!#|[a-z])[a-z]+/i', 'replace_chars', $text); that take all the words words with the # at the END and change those strings rather than the #sound being at the begining and not changing those?
  2. K i got what i wanted it to do... thanks!! but now one more question - im sure it's really easy but i just can't get it... how do i select the words with only the # sign rather then everything but...
  3. perfect - ill play around with that... thanks!
  4. good questions - i guess i need to think about being more clear, sorry. i would want each letter to have something or even if each letter got replaced with a different set of letters like "a" got replaced with "a1" and "b" got replaced with "493" something like that.. i know i prob would have to write what each letter would be replaced with but how do i avoid a word in the string with a # sign is what im trying to ask. sorry for the confusion but thanks much for your help!
  5. That words perfect but what if instead of the "*" i wanted each letter to be different like for every "a" it would replace it with a "a1" and be would be "b1" and etc... so $text = "theres #are the abc" would be "t1h1e1r1e1s1 #are t1h1e1 a1b1c1" ?? sorry guess i should have been more clear - i thought there would be a way you can replace each letter with something different except for the letters attached to the word with the #...
  6. i know that you can do: str_replace($replaceWith,$replacethis,$sentence); lets say i did that 26 times one for each letter of the alphabet. Can i still do that but once it reaches a charater that is a part of a word that has the "#" symbol in front of it, it wont replace any characters in that string? so i would want this : " this is a #test" to be : "**** ** * #test" it's not going to be all stars but just using it for this purpose. any comments/ideas? thanks!!
  7. wow thats two dumb mistake in a row...i think i need to call it a night.. thanks for all your help i love this site..just found it today
  8. ok another problem... i got it to move on without an error but i dont get a blank variable back...or just dont get anything back period... any advise? <? include 'config.php'; include 'opendb.php'; $DefCategory = $_POST['DefineCategory']; $DefCatalog = $_POST['DefineCatalog']; $DefPage = $_POST['DefinePage']; echo "Processing Page " .$DefPage ." in " .$DefCatalog ." under the " .$DefCategory ." category."; $result = mysql_query("SELECT Category_ID FROM a WHERE category_name = '$_POST[DefineCategory]' ") or die(mysql_error()); echo $result['Category_ID']; while($row = mysql_fetch_array($result)) { $CategoryIDfromDB = $row["Catagory_ID"]; echo "<br /> your Category ID is: " .$CategoryIDfromDB; } ?> anything is appreciated.
  9. cool...thanks. It points out the problem exactly now... I should have done that in the first place...
  10. oops missed that...but for some reason i keep getting the same error... this is how my code looks now... <? include 'config.php'; include 'opendb.php'; $DefCategory = $_POST['DefineCategory']; $DefCatalog = $_POST['DefineCatalog']; $DefPage = $_POST['DefinePage']; echo "Processing Page " .$DefPage ." in " .$DefCatalog ." under the " .$DefCategory ." category."; $result = mysql_query("SELECT Catagory_ID FROM a WHERE category_name = $DefCategory"); while($row = mysql_fetch_array($result)) { $CategoryIDfromDB = $row["Catagory_ID"]; echo $row['Catagory_ID']; } ?> and this is the error i keep getting... Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/elemenu9/public_html/rexdist/processEntry.php on line 15 I thought that error for was when your not connected to a database but my config.php and opendb.php take care of that...right?
  11. can someone please let me know what im doing wrong? I thought this would be easy but i guess not... basically there are variables being posted to this page and I need it to look up in the database and get the catalog_ID for .... this is what i have so far... <? include 'config.php'; include 'opendb.php'; $DefCategory = $_POST['DefineCategory']; $DefCatalog = $_POST['DefineCatalog']; $DefPage = $_POST['DefinePage']; echo "Processing Page " .$DefPage ." in " .$DefCatalog ." under the " .$DefCategory ." category."; $result="SELECT Catagory_ID FROM a WHERE category_name = '{$_POST[DefineCategory]}' "; while($row = mysql_fetch_array($result)) { $CategoryIDfromDB = $row["Catagory_ID"]; echo $row['Catagory_ID']; } ?>
  12. YES!!! Thanks man... i went ahead and added the pagenum number as well as the format so now it works perfect... this is my final code...for now... <?php include 'config.php'; include 'opendb.php'; // the query $query = "SELECT DISTINCT a.category_name as category, b.Catalog_Name as catalog, c.pagenum as pagen, c.cat_id as catID FROM c INNER JOIN b ON c.cat_id = b.Catalog_ID INNER JOIN a on a.Category_ID = c.Category_ID ORDER BY a.category_name, b.Catalog_Name"; $result = mysql_query($query); $category = null; $previous_cat = null; while($row = mysql_fetch_array($result)) { $category = $row['category']; if ($category != $previous_cat) { echo "{$category}</br />"; $previous_cat = $row['category']; } echo "{$row[catalog]}<br />"; echo "<a href='catalogView.php?catalog={$row[catID]}&page={$row[pagen]}'>{$row[pagen]}</a><br />"; } ?>
  13. here is how my database tables look: table: a category_name Category_ID Air 0 Bin 1 table: b Catalog_Name Catalog_ID Catalog A 0 Catalog B 1 table: c cat_id Category_ID pagenum 0 0 1 0 1 2 (just incase)... thanks again..
  14. Actually im getting the same error as before... Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/elemenu9/public_html/rexdist/test.php on line 16 but your coding looks much better than mine...
  15. Ok this is the code I got... but its not working, Im sure it something below that i wrote is wrong... thanks for all your help... (my tables are actually called a,b, & c) <?php include 'config.php'; include 'opendb.php'; $query = "SELECT a.category_name, b.Catalog_Name, GROUP_CONCAT(c.pagenum ORDER BY pagenum) as pages FROM content c INNER JOIN catalog b ON c.cat_id = b.Catalog_ID INNER JOIN category a.Category_ID = c.Category_ID GROUP BY a.category_name, b.Catalog_Name"; $result = mysql_query($query); while($row = mysql_fetch_array($result)) { if (category != previous_cat) { echo "{$row['a.catagory_name']}"; $previous_cat = $row['a.catagory_name']; } echo "{$row['b.Catalog_Name']}"; } ?>
×
×
  • 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.