Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Database Question - Easy one


propowders

Recommended Posts

Hey guys.. im having an issues with my site readin/writing to the DB

 

Im getting the following error message

 

1064 - You have an error in your SQL syntax near ' ipaddy, ipisp orders where orders_id = '15'' at line 1

select customers_name, customers_email_address, orders_status, date_purchased from, ipaddy, ipisp orders where orders_id = '15'

[TEP STOP]

 

This is where i think the issue is:

  `cc_type` varchar(20) default NULL,
 `cc_owner` varchar(64) default NULL,
 `cc_number` varchar(32) default NULL,
 `cc_expires` varchar(4) default NULL,
 `last_modified` datetime default NULL,
 `date_purchased` datetime default NULL,
 `currency_value` decimal(14,6) default NULL,
 `ipaddy` varchar(15) NOT NULL default '',
 `ipisp` varchar(15) NOT NULL default '',
 PRIMARY KEY  (`orders_id`)
) TYPE=MyISAM AUTO_INCREMENT=16;

 

What I was hoping is if someone can tell me what the numbers mean in the above database code and if you could also tell me what "default NULL" & "NOT NULL default" means.. this will help me work out the issue..

 

Also does OsCommerce store ip addresses of the customer who place orders?

Chris

Director

ProPowders.com.au

Your Online Health Supplement Store

Link to comment
Share on other sites

Chris,

 

The correct format is

 

select Column A, Column B, .....

From Table Name

Where <condition>

 

I see you have a ',' after the from clause and that's an wrong.

 

Default NULL means that the column can be blank. If a column is NOT NULL, then you must provide a value.

 

Cheers

 

Shoshoni

Link to comment
Share on other sites

<table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
           <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
             <tr class="dataTableHeadingRow">
               <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_ONLINE; ?></td>
               <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_CUSTOMER_ID; ?></td>
               <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_FULL_NAME; ?></td>
               <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_IP_ADDRESS; ?></td>
               <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_ENTRY_TIME; ?></td>
               <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_LAST_CLICK; ?></td>
               <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_LAST_PAGE_URL; ?> </td>
             </tr>
<?php
 $whos_online_query = tep_db_query("select customer_id, full_name, ip_address, time_entry, time_last_click, last_page_url, session_id from " . TABLE_WHOS_ONLINE);
 while ($whos_online = tep_db_fetch_array($whos_online_query)) {
   $time_online = (time() - $whos_online['time_entry']);
   if ((!isset($HTTP_GET_VARS['info']) || (isset($HTTP_GET_VARS['info']) && ($HTTP_GET_VARS['info'] == $whos_online['session_id']))) && !isset($info)) {
     $info = $whos_online['session_id'];
   }

   if ($whos_online['session_id'] == $info) {
     echo '              <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)">' . "\n";
   } else {
     echo '              <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_WHOS_ONLINE, tep_get_all_get_params(array('info', 'action')) . 'info=' . $whos_online['session_id'], 'NONSSL') . '\'">' . "\n";
   }
?>
               <td class="dataTableContent"><?php echo gmdate('H:i:s', $time_online); ?></td>
               <td class="dataTableContent" align="center"><?php echo $whos_online['customer_id']; ?></td>
               <td class="dataTableContent"><?php echo $whos_online['full_name']; ?></td>
               <td class="dataTableContent" align="center"><?php echo $whos_online['ip_address']; ?></td>
               <td class="dataTableContent"><?php echo date('H:i:s', $whos_online['time_entry']); ?></td>
               <td class="dataTableContent" align="center"><?php echo date('H:i:s', $whos_online['time_last_click']); ?></td>
               <td class="dataTableContent"><?php if (eregi('^(.*)' . tep_session_name() . '=[a-f,0-9]+[&]*(.*)', $whos_online['last_page_url'], $array)) { echo $array[1] . $array[2]; } else { echo $whos_online['last_page_url']; } ?> </td>
             </tr>
<?php
 }
?>
             <tr>
               <td class="smallText" colspan="7"><?php echo sprintf(TEXT_NUMBER_OF_CUSTOMERS, tep_db_num_rows($whos_online_query)); ?></td>
             </tr>
           </table>

 

this creates the whosonline table in admin

 

should be possible to integrate the query in checkout_process.php

 

dahui

 

forgott to mention the while clause must be eliminated and the output has to be matched with global customer_id

Link to comment
Share on other sites

I managed to integrate the ip and all data if wanted from who's online table to the mail that is send to me, so I have to mails one for cutomer, nice and no ip, other for me, flat with ip.

 

pm me ig need assistance

 

dahui

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...