How to make Table Joins in PHPmyAdmin

Question by Mark

I have 2 Tables in phpmyadmin that need joining

tracklisting is my one and catelogue is the other, and are saved as innodb

They both have a column CAT.NO and would like it to be joined on this column. In catelogue it is the primary and in tracklisting it’s indexed

catelogue is my parent and tracklisting would be the child as it doesn’t have info for every record in catelogue. I believe this would be correct unless I’m wrong

How do I do this so that when I query on a column in tracklisting it only brings up the matches for ‘catelogue’ because I want to know what album it’s on and not my entire 60000+ catelogue

Can this be done with phpmyadmin’s interface or is this a sql statement

Many thanks

EDIT:

This was the code that worked

SELECT *
FROM tracklisting
INNER JOIN catelogue ON catelogue.`CAT NO.` = tracklisting.`TRACKLISTING CAT NO.`
WHERE tracklisting.`ARTIST` LIKE 'placebo'

Thanks to everyone that helped out

Answer by Starx

I dont know if this can be done with the interface, but with sql

SELECT * 
FROM 
  tracklisting t 
  INNER JOIN catelouge c on c.catno=t.catno 
WHERE t.id = 1

How to use the float:left property in CSS without having the trouble I have?

Question by Prateek

i’m trying to create a flow layout and i’m having some trouble using float:left property in css.

I have one parent container which has 100% width and 100% height. It contains three containers:
The header, the menu container, and the content container.
The menu is a vertical menu,not a horizontal menu. It comes below the header and then the content container floats left on the menu container.
Now the problem is i want to make it flowlayout. When i reduce the resolution,the floating content container comes below the menu container. I want the content to float with a flowlayout without coming below the menu container.Please provide a solution to this.
Thanks!

Here is the link to the code.

http://jsfiddle.net/VdE7Y/

Answer by Scott

Remove the width and float from the #content css.

Set the background color of #wrapper to be whatever color you want the background of #content to be.

add display: inline-block; to the #content css.

Updated fiddle —-> HERE

Answer by Starx

The problem is the min-width you have for #menu-cont

The layout you are trying to have is very hard to maintain.

December 30, 2011

Sending a get variable to php file through getJSON?

Question by holyredbeard

Is it possible to send a parameter (eg. a get variable) with getJSON to a php file, and if so how to do it?

The code below doesn’t work, but hopefully it shows what I try to accomplish.

var url = "http://www.address.com/"

$.getJSON('http://anotheraddress.com/messages.php?url=+escape(url))', function(data) {
    // code here
});

Answer by James Thorpe

$.getJSON accepts another parameter for data:

var url = "http://www.address.com/"

$.getJSON('http://anotheraddress.com/messages.php', { url: escape(url) }, function(data) {
    // code here
});

Answer by Starx

Your jquery might look something like this

$.getJSON("messages.php", 
{
   data1: value1,
   data2: value2,
   url: escape(url)
},
function(data) { 
    alert(data.yourval);
});

The only thing you should remember while using getJSON is that, the php page message.php should return JSON string as a response. SO you have do something like this at the end of the file.

echo json_encode($responseArray);
// Remember not to echo or output anything or the JQuery will not execute

How to use ajax in zend framework?

Question by sarunathan

I tried a simple ajax aplication using jquery, where i had my php file in an separate folder in my root and it is working.

Is there any other way to use ajax in a zend framework?

Answer by Starx

There are some ways you can do it

  1. Use ZendX_JQuery. They have helper called ajax_link, with which you can use make ajax call directly from a link.

  2. Embed a js file, in your file and use ajax there. Use something like:

    $this -> headLink() -> appendScript(‘path/to/your/script’);

    You might have to import the JQuery file like this, if you have not enabled this, using the ZendX_JQuery helper.

  3. Directly feed script content like <script>...</script> like you would raw html

However, JQuery helper might take a bit to fully understand. If you are already familier with JQuery, and know how to use it properly. Go with option number 2.

๐Ÿ™‚

Remove/Add hover after toggle Jquery

Question by hyperrjas

I have this css:

.disable {
          properties
          }

.comment_action:hover {
                       properties
                       }

I have this jQuery:

//comment button index disable
$("#mydiv").toggle(function() {
 $(this).find(".comment_action").addClass('disable');   
},
function(){
 $(this).find(".comment_action").removeClass('disable');
});

The problem for me is that when I doing click the .comment_action:hover is not disappear or removed. I want that If I doing click on the class .comment_action:hover dissapear and if I doing click again the .comment_action:hover appear.

Answer by lawrence.alan

You would need an !important added to properties you want to override in the :hover psuedo-selector…

Because :hover takes precedence, even if .disabled is applied.

Also your javascript should be calling find with .comment_action instead of comment_action

See working example: http://jsfiddle.net/TN4rh/11/

Answer by Starx

Better solution would be toggle the class. What you are trying to do can be done in one line.

$("#mydiv").click(function() {
    $(this).find(".comment_action").toggleClass('disable');       
});

Demo

๐Ÿ™‚

December 29, 2011

how to know how many pages a particular user visited in a particular session

Question by Anup Kumar

i am working on a e-commerce website, i want to monitor how many pages a users visited in a particular session. there are only registered users of the site.
can any one tell me how to record the URL of the user of a particular session,
i am using php and mysql

Answer by Starx

There are more than one way to do this. Here is one quick walkthrough:

  1. Create a table with two fields (‘session_id’, ‘url’);

  2. Whenever the site loads, read the sessionid using session_id(), and use this value to store the url of the page in a table for every pages the people visit.

  3. Once a page loads, read the URL, through $_SERVER['REQUEST_URI']; and then use it the value of session_id() and store the records.

After you implement this simple technique. you can see how many people see the pages, using a simple query

SELECT count(*) FROM <YOURSESSIONTABLE> GROUP BY `<session_id_field>`

P.S. This is one of the basic example, and should be changed to fit your requirements

How to deselect tabs in jquery

Question by sasirekha

$(document).ready(function() {
    $('#tabs > ul').tabs('select', 1);
    $('#tabs').tabs({
        selected: 1
    });
    $("#tabs").tabs({
        disabled: [0, 2, 3]
    });
    return false;
});

To move to another tab, CSS style is not followed. How do I deselect the current tab?

Answer by Starx

Use the following to select a different tab or move to another tab.

$( "#tabs" ).tabs( "option", "selected", 2 );

However, to deselect the current tab, you have to select another tab, that’s the only way the tabs work. If you want to clear the style of current selected tabs then use

$("#tabs .ui-tabs-selected").removeClass("ui-state-active").removeClass("ui-tabs-selected");});

how to play wav stream in safari vai javascript

Question by Jeffrey Hsu

I’ve tried Audio / embed / Object, but fail at all of them.

play wave file is ok, but cannot play stream.

<audio><source src="sample.wav" /></audio> OK

<audio><source src="http://mydomain/stream" /></audio> fail

<object data="sample.wav"></object> OK

<object data="http://mydomain/stream"></object> fail

jPlayer also cannot work!

I found a clue:
If when I play it in firefox before, then safari works. It seems firefox download it so the safari can play it in quicktime’s cache.
code:
<embed src="http://10.224.91.28:8080/cas/auth.do?cmd=getaudiobycaptchaid&id=Q71UNBGRFOI00A8NDNBV76BTNE&clientid=9e1f73ca9d0ff1e07ca87f7660d1b911" height="45" width="170" type="audio/x-wav"/>

Answer by Starx

You should use html5audioplayer. It slags a bit, but works in the end….

...

Please fill the form - I will response as fast as I can!