Jump to content

countrygyrl

Members
  • Posts

    14
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

countrygyrl's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I tried asking this question in the joomla forums but noone had the answer for me. I am using a joomla extension called form2content and the template files must have the extension .tpl I am trying to put an if statement in there to only show certain things at certain times but I can't seem to get it to work properly. I have done tons of research on this and can not find the answer so I was hoping someone might have enough experience with .tpl files to help me out here. Any help would be greatly appreciated. I have tried many things nothing has worked but here is my code right now: <mos:tmpl name="root"> <!--[iF (HORSESIRE != "")]--> <p><strong>{HORSENAME}'s Pedigree Information:</strong></p> <table cellpadding="0" cellspacing="1" width="75%"> <tr> <td rowspan="4" class="maternal">{JOOMLA_TITLE}</td> <td rowspan="2" class="maternal">{HORSESIRE}</td> <td class="maternal">{HORSEGRANDSIRESIRE}</td> </tr> <tr> <td class="paternal">{HORSEGRANDDAMSIRE}</td> </tr> <tr> <td rowspan="2" class="paternal">{HORSEDAM}</td> <td class="maternal">{HORSEGRANDSIREDAM}</td> </tr> <tr> <td class="paternal">{HORSEGRANDDAMDAM}</td> </tr> </table> <!--[ELSE IF (HORSEPHOTO1 != "")]--> <p><strong>Photos of {HORSENAME}</strong></p> <p>Click on any of the images below to view a larger image. When you are done, simply click close to return to this page</p> <table class="pics"> <tr> <td>{HORSEPHOTO1}</td> <td>{HORSEPHOTO2}</td> <td>{HORSEPHOTO3}</td> <td>{HORSEPHOTO4}</td> <td>{HORSEPHOTO5}</td> <td>{HORSEPHOTO6}</td> </tr> </table> <!--[ELSE IF (FOAL4SALE1PIC != "")]--> <p><strong>{HORSENAME} has the following foals which are for sale:</strong></p> <table class="pics"> <tr> <td align="center">{FOAL4SALE1PIC}</td> <td align="center">{FOAL4SALE2PIC}</td> <td align="center">{FOAL4SALE3PIC}</td> <td align="center">{FOAL4SALE4PIC}</td> <td align="center">{FOAL4SALE5PIC}</td> <td align="center">{FOAL4SALE6PIC}</td> </tr> <tr> <td class="caption">{FOAL4SALE1}</td> <td class="caption">{FOAL4SALE2}</td> <td class="caption">{FOAL4SALE3}</td> <td class="caption">{FOAL4SALE4}</td> <td class="caption">{FOAL4SALE5}</td> <td class="caption">{FOAL4SALE6}</td> </tr> <tr> <td align="center">{FOAL4SALE7PIC}</td> <td align="center">{FOAL4SALE8PIC}</td> <td align="center">{FOAL4SALE9PIC}</td> <td align="center">{FOAL4SALE10PIC}</td> <td align="center">{FOAL4SALE11PIC}</td> <td align="center">{FOAL4SALE12PIC}</td> </tr> <tr> <td class="caption">{FOAL4SALE7}</td> <td class="caption">{FOAL4SALE8}</td> <td class="caption">{FOAL4SALE9}</td> <td class="caption">{FOAL4SALE10}</td> <td class="caption">{FOAL4SALE11}</td> <td class="caption">{FOAL4SALE12}</td> </tr> </table> <!--[endif]--> </mos:tmpl>
  2. OMG I can't believe it I got it to work, by adding 1 little thing to the php code. All I did was add , Now() to the INSERT statement, here was the answer in case this will help someone else out someday: function addNewUser($username, $password, $email, $fname, $lname, $address, $city, $prov, $pcode, $country, $telephone, $paymentmethod, $purchasecode){ $time = time(); $purchasecode = $_SESSION['PurchaseCode']; if(strcasecmp($username, ADMIN_NAME) == 0){ $ulevel = ADMIN_LEVEL; }else{ $ulevel = GUEST_LEVEL; } $q = "INSERT INTO ".TBL_USERS." VALUES ('$username', '$password', '0', $ulevel, '$email', '$fname', '$lname', '$address', '$city', '$prov', '$pcode', '$country', '$telephone', '$paymentmethod', '$purchasecode', $time, Now())"; return mysql_query($q, $this->connection); }
  3. I need some help with a date field in a database. This is what I "want" to have happen, but I have tried many different things and I can't make something that should be so easy work at all!! I have a registration form and everything works great until I try and add a date joined to the database. What I want to do is just have mySQL automatically enter the current date and time when the person registers, I don't want the date to adjust on update I just want the date and time joined to stay forever. I had put in a column entitled joined with a type of TIMESTAMP a default of CURRENT_TIMESTAMP and NOT NULL when I add this into the database, it will not insert a new record, the form fails, when I remove it the form processes perfectly. I want my mySQL database to handle this without any involvement from the PHP form processing, is this possible? I am using PHP version 5.2.13 and mySQL 5.1.45 and I also want to say ahead of time that I have been googling date and looking in the manual and trying to figure out how to do this properly and I still can't figure it out so please help.
  4. Ok I got it, I gave a value to a session variable if there were errors on that particular form and only ran the php error display code if that value was equal to 1 and then unset the session variable as soon as the code was displayed, thanks for your help.
  5. Unfortunately, that won't work for me because the error messages for the two different forms show up in two different areas of the page. I am looking for something like this, but of course this doesn't work lol if (sublogin == 1) { if($form->num_errors > 0){ echo "<p><span class=\"error\">".$form->num_errors." error(s) found</span><br />"; echo "<p><span class=\"error\">".$form->error("user2")."</span><br />"; echo "<span class=\"error\">".$form->error("pass2")."</span></p>"; } }
  6. I have a page that I have two forms on, both forms have error processing, I am banging my head against the wall and I need some fresh eyes. It's probably something simple but I can't wrap my head around it. What I need is an if statement that says only show the num_errors and the errors themselves if this form has been submitted or something? <? if($form->num_errors > 0){ echo "<p><span class=\"error\">".$form->num_errors." error(s) found</span><br />"; echo "<p><span class=\"error\">".$form->error("user2")."</span><br />"; echo "<span class=\"error\">".$form->error("pass2")."</span></p>"; } ?> <form action="process.php" method="POST"> <p><label for="user2">Username:</label><input type="text" name="user2" maxlength="30" size="10" value="<? echo $form->value("user2"); ?>" /></p> <p><label for="pass2">Password:</label><input type="password" name="pass2" maxlength="30" size="10" value="<? echo $form->value("pass2"); ?>" /></p> <p><input type="checkbox" name="remember" <? if($form->value("remember") != ""){ echo "checked"; } ?> /> Remember me <input type="hidden" name="sublogin" value="1" /> <input type="submit" value="Login" /></p> <p class="legal">[<a href="forgotpass.php">Forgot Password?</a>]</p> </form>
  7. Thank you very much for your awesome help, I found the problem, there was a $ sign where there shouldn't have been but you probably put it there to test me Here is the final working code, in case it will help anyone else: $query = "SELECT invoice_id, date, SUM(total) as invoiceTotal FROM si_invoices LEFT JOIN si_invoice_items ON si_invoices.id = si_invoice_items.invoice_id WHERE si_invoices.customer_id='$_SESSION[user_id]' GROUP BY invoice_id ORDER BY invoice_id"; $result = mysql_query($query); $row=0; while ($record = mysql_fetch_assoc($result)) { $class = 'd' . ($row % 2); $inv_date=substr($record['date'], 0, -9); $inv_total=$record['invoiceTotal']; $invoice_total=number_format($inv_total, 2); echo "<tr class=\"{$class}\">"; echo "<td valign='top'>{$inv_date}</td>"; echo "<td valign='top'>{$record['invoice_id']}</td>"; echo "<td valign='top'>$invoice_total</td>"; echo "<td><a href='invoices/Invoice{$record['invoice_id']}.pdf' target='_blank'>"; echo "<img src='../images/pdf_icon.gif' width='17' height='17' alt='PDF File' border='0' /></a></td>"; echo "</tr>"; $row++; }
  8. It seems to grab the invoice_id and date just fine, but not the total for each one, any idea why?
  9. How would I add to the code below. This code works great for me but on occasion there will be times when there are matching values in invoice_id. What I want to do is say if the invoice_id matches a previous invoice_id, add the new amount in total to the total in the matching row, don't make another table row. If it does not match any of the previous invoice_id values then make a new table row. Can anyone please help me? $result = mysql_query("SELECT * FROM si_invoices LEFT JOIN si_invoice_items ON si_invoices.id = si_invoice_items.invoice_id WHERE si_invoices.customer_id='$_SESSION[user_id]' ORDER BY invoice_id"); $num=mysql_num_rows($result); $i=0; while ($i < $num) { $inv_id=mysql_result($result,$i,"id"); $inv_invoice_id=mysql_result($result,$i,"invoice_id"); $inv_customer_id=mysql_result($result,$i,"customer_id"); $inv_gross_total=mysql_result($result,$i,"gross_total"); $inv_description=mysql_result($result,$i,"description"); $inv_total=mysql_result($result,$i,"total"); $inv_total=number_format($inv_total, 2); $inv_date=mysql_result($result,$i,"date"); $inv_date=substr($inv_date, 0, -9); $pay= mysql_query("select * from si_payment where ac_inv_id='$inv_invoice_id'"); echo "<tr class=\"d".($i & 1)."\"><td valign='top'>$inv_date</td><td valign='top'>$inv_invoice_id</td><td valign='top'>$$inv_total</td><td><a href='invoices/Invoice$inv_invoice_id.pdf' target='_blank'><img src='../images/pdf_icon.gif' width='17' height='17' alt='PDF File' border='0' /></a></td></tr>"; $i++; }
  10. um yeah the manual, we don't get along so good. I searched and searched and couldn't find anything that worked.
  11. OMG thank you so much!!!! You have no idea, I have been working on this syntax for three days. I just about peed my pants when I got the result I was looking for lol
  12. Unfortunately that didn't work, this is my code right now I am getting no result. If I take the sql statement alone and put it in the database I do get the correct result, so i know the problem is with the way I am trying to get the sql result into php $result=mysql_query("SELECT SUM(si_invoice_items.total) AS $total_invoices FROM si_invoices LEFT JOIN si_invoice_items ON si_invoices.id si_invoice_items.invoice_id WHERE si_invoices.customer_id='$_SESSION[user_id]'"); $total_invoices = $total;
  13. I have a query that works in phpmyadmin but I can't figure out how to pull the result from it, I am also pretty sure there is a prettier way to write the sql query but hey, it works and my daddy always taught me not to fix it if it isn't broke. Soo if someone can tell me how to actually utilize this sql statement in a php page that would be great: SELECT SUM(si_invoice_items.total) AS $total_invoices FROM si_invoices LEFT JOIN si_invoice_items ON si_invoices.id = si_invoice_items.invoice_id WHERE si_invoices.customer_id='$_SESSION[user_id]'
×
×
  • 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.